There was an error while loading. Please reload this page.
1 parent 84192ba commit 85ee312Copy full SHA for 85ee312
1 file changed
implement-shell-tools/wc/wc.py
@@ -61,8 +61,6 @@ def read_file(file_name):
61
62
63
def calculate_line_count(text):
64
- if not text:
65
- return 0
66
return len(text.splitlines())
67
68
@@ -93,12 +91,12 @@ def add_totals(all_files_data):
93
91
94
92
# ===== Outputting Data =====
95
def print_output(output_data):
+ active_metrics = displayed_metrics or metrics
96
for file in output_data:
97
output_string = ""
98
99
- for metric in metrics:
100
- if not displayed_metrics or metric in displayed_metrics:
101
- output_string += str(file[metric]).rjust(8)
+ for metric in active_metrics:
+ output_string += str(file[metric]).rjust(8)
102
103
output_string += f" {file['name']}"
104
print(output_string)
0 commit comments