In this task, you’ll extend the functionality of the wordcount
command by adding support for counting characters. Character counting will complement the existing feature of counting lines, words, and bytes, effectively emulating the behavior of the --chars
flag in the original wc
command.
Acceptance Criteria
- The program should support any combination of the following command-line options:
--lines
,--words
,--bytes
, and--chars
. - When the
--chars
flag is used alone, only the character count should be displayed. - Any combination of other flags should also be supported.
- In the absence of command-line flags, your program should default to displaying lines, words, and bytes.
- The displayed counts should always follow this order: lines, words, characters, bytes.
- The program should count a multi-byte Unicode codepoint as a single character.
Examples
Running the command with no command-line flags: