How urfave/cli works
urfave/cli is a Go library for building declarative command-line applications. An application author defines commands, arguments, and typed flags; a caller runs the command, which parses input, selects commands, and invokes application actions. The package also provides help, shell completion, and flag-value sources, with documentation generation exposed as a capability. The main execution handoffs are only partly visible in the excerpts, so unverified links are dashed; documented capabilities are retained without asserting unsampled call paths.
Main entry points: command_run.go Run command · flag.go Flag definitions · help.go Help output · command.go Command model
Components 18
Command execution
- Run command
command_run.go - Command model
command.go - Command setup
command_setup.go - Flag parser
command_parse.go - Command dispatch
command_run.go
Inputs and flags
- Positional arguments
args.go - Flag definitions
flag.go - Typed flag values
flag_impl.go - Inverse boolean flags
flag_bool_with_inverse.go - Value sources
value_source.go
User-facing features
- Help output
help.go - Help rendering
help_template.go - Plain help rendering
help_notemplate.go - Shell completion
completion.go - Fish completion
fish.go - Docs generation
docs.go
Other components
- Application author
- Application action
Connections 17
- Application author → Command model: defines commands
README.md - Application author → Run command: runs
README.md - Run command → Command setup: initializes
- Run command → Flag parser: parses input
- Run command → Command dispatch: dispatches commands
command_run.go - Command dispatch → Application action: invokes action
- Run command → Positional arguments: provides arguments
- Flag parser → Flag definitions: sets flags
- Flag definitions → Typed flag values: uses values
- Flag definitions → Inverse boolean flags: supports boolean flags
- Typed flag values → Value sources: reads fallback values
- Run command → Help output: shows help
- Help output → Help rendering: renders templates
- Help output → Plain help rendering: renders without templates
- Run command → Shell completion: supports completion
- Shell completion → Fish completion: supports Fish
- Command model → Docs generation: exposes doc generation