We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4d2796 commit d4cd590Copy full SHA for d4cd590
1 file changed
implement-shell-tools/wc/wc.py
@@ -130,5 +130,25 @@ def counter(item):
130
print(f"{stats['characters']} {path}")
131
else:
132
print(f"{stats['lines']} {stats['words']} {stats['characters']} {path}")
133
+ elif os.path.isdir(path):
134
+ directory = "folder"
135
+
136
+ for file in os.listdir(directory):
137
+ path = os.path.join(directory, file)
138
139
+ if os.path.isfile(path):
140
+ with open(path, "r") as f:
141
+ content = f.read()
142
+ stats = counter(content)
143
+ if args.line:
144
+ print(f"{stats['lines']} {path}")
145
+ elif args.word:
146
+ print(f"{stats['words']} {path}")
147
+ elif args.char:
148
+ print(f"{stats['characters']} {path}")
149
+ else:
150
+ print(f"{stats['lines']} {stats['words']} {stats['characters']} {path}")
151
152
153
154
0 commit comments