Cobra
A widely used third-party Go library for building command-line tools with subcommands, nested help and shell completion.
In more detail
kubectl, the GitHub CLI and many other tools are built with it. It uses pflag for GNU-style options. For a tool that does one job, the standard flag package is enough and adds no dependency to audit.
Related terms
- pflag — A third-party Go library that replaces the standard flag package with GNU-style options, such as --verbose and bundled -v short flags.
- subcommand — The word after a program's name that picks which of its operations to run, such as status in git status.
- flag package — Go's standard library package for parsing command-line options into typed values with defaults and a generated usage message.
- shell completion — A shell feature that suggests or fills in a command's subcommands, flags and arguments when you press Tab.
Taught in
- Parsing Arguments with flag — Concurrent Systems Programming with Go