A Go module for defining commands, flags, help, and shell completion when you build terminal tools.
Overview
urfave/cli helps Go developers describe command-line programs in a declarative style. You define commands and subcommands, then wire actions and flags without writing large amounts of parsing boilerplate by hand. The project is in maintenance mode and receives only security and bug fixes.
The package supports command aliases and prefix matching, a flexible help system, and dynamic completion for bash, zsh, fish, and PowerShell. Flags cover common scalar types, slices, durations, and times, including grouped short options.
Optional companion modules can load settings from environment variables, plain text files, or structured formats, and can generate man pages or Markdown documentation. It relies on the Go standard library only.
Maintainers publish multiple major release lines with separate migration guides. Automated tests cover recent Go releases on Linux, macOS, and Windows.
Key features
- Commands and subcommands
- Alias and prefix matching
- Shell completion
- Flag and duration parsing
- Compound short flags
- Help and man generation
- Environment and file inputs
- Standard-library only
Use cases
- Go developer CLIs
- Multi-subcommand DevOps tools
- Internal automation binaries