Command-Line Flags

Good command-line tools provide flexibility through options. The current version of the word counter tool only counts words. Let’s add the ability to also count lines by giving the user the option to decide when to switch this behavior through command-line flags. Go provides the flag package, which can be used to create and manage command-line flags.

Get hands-on with 1400+ tech skills courses.