Usage keeps Go’s standard flag package underneath and adds what real tools need around it: grouped options, positional arguments, coloured help with a plain-text fallback, and a choice between returned errors and panics.
Usage
Command-line argument parsing for Go — option groups, positional arguments and generated help with version and build metadata, on top of the standard flag package.
u := usage.NewUsage(
usage.WithApplicationName("myapp"),
usage.WithApplicationVersion("1.0.0"),
usage.WithApplicationDescription("My awesome CLI application"),
)
verbose, _ := u.AddBooleanOptionE("v", "verbose", false, "Enable verbose output", "", nil)
port, _ := u.AddIntegerOptionE("p", "port", 8080, "Server port", "", nil)
u.Parse()- Status
- shipped
- Year
- 2024
- Role
- Author
- Stack
- Go · CLI