A command-line tool is a console application operated through textual commands, options, flags, and arguments. These inputs form its user interface and support system commands, utilities, database clients, and development tools. section 2.1
A practical command-line tool commonly provides:
- Standard-library flag handling for basic options and arguments, including many parsing edge cases. section 2.1
- UNIX-style short and long flags when users expect conventions such as -la. section 2.1.4
- Commands and subcommands supplied by a command-line framework rather than repeated project-specific parsing code. section 2.1.4
- Configuration loaded from environment variables or files, with operational commands that can start and gracefully stop services. section 2.0
A flagged greeting command
A small Go CLI can expose a name option with both long and short forms: hello_cli --name Inigo and hello_cli -n Inigo. A framework can add help, version information, required flags, language selection, and a command structure. The same approach extends to subcommands such as a calculator's add, sub, mul, and div operations.


