Multi-level demo for github.com/google/subcommands
This tutorial contains one branch per topic.
Usage
Checkout each branch in turn to learn one level at a time.
- Ensure you have already installed:
- A working Go SDK
- The
staticcheck
linting tool
- The
make
command
- Run
make
to see the new features in that branch
Contents
- simple subcommands
- basic usage with builtin commands
- creating commands with the procedural API
- passing non-CLI arguments
- command groups
- adding command flags
- marking flags as important
- reusing command code
- commanders
- procedural vs object API
- creating commands with custom commanders
- creating a testable command structure
- creating nested commands
- beyond
NewCommander
- controlling output
- introspecting commanders
- replacing builtins