Cobra
lastmod 2025-06-28created 2025-06-281 edits
Cobra is a library for creating powerful modern CLI applications.
A powerful Go-based library for developing CLI apps
Features
- The most widely used CLI app development library in the Go ecosystem, adopted by many major projects such as Kubernetes, Hugo, and GitHub CLI
- Supports subcommand structures like app server, as well as nested subcommands and inherited flags, making it suitable for large apps
- The command, argument, and flag structure enables intuitive and extensible app design, and supports natural command scenarios
- Fully POSIX-compliant flags
- Smart automatic typo suggestions: typing app srver suggests app server
- Automatic help and man page generation for each command and flag
- Shell autocompletion for bash, zsh, fish, powershell, and more
- Integrates with Viper to support 12-factor app environment variables
- The cobra-cli tool enables quick scaffolding and command file generation, making even large-scale CLI app development efficient