pflag
A third-party Go library that replaces the standard flag package with GNU-style options, such as --verbose and bundled -v short flags.
In more detail
Cobra uses it underneath. Choose it when users expect the double-dash long options common in Linux tools.
Related terms
- Cobra — A widely used third-party Go library for building command-line tools with subcommands, nested help and shell completion.
- command-line option — An argument starting with a dash, such as -r or --help, that changes how a command behaves rather than naming what it works on.
- flag package — Go's standard library package for parsing command-line options into typed values with defaults and a generated usage message.
- GNU — A free-software project that wrote many standard command-line tools, including Bash, grep, sed and the core file utilities.
Taught in
- Parsing Arguments with flag — Concurrent Systems Programming with Go