Skip to content

Commit f73102e

Browse files
committed
Add total with flags
1 parent cc5dbf9 commit f73102e

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • implement-shell-tools/wc

implement-shell-tools/wc/wc.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,12 @@ def count_text(text):
5151
else:
5252
print(lines, words, chars, path)
5353

54-
if len(args.path) > 1 and not args.l and not args.w and not args.c:
55-
print(lineCounter, wordCounter, charCounter, "total")
54+
if len(args.path) > 1:
55+
if args.l:
56+
print(lineCounter, "total")
57+
elif args.w:
58+
print(wordCounter, "total")
59+
elif args.c:
60+
print(charCounter, "total")
61+
else:
62+
print(lineCounter, wordCounter, charCounter, "total")

0 commit comments

Comments
 (0)