Go CLI Cobra
Build professional command-line applications in Go with Cobra commands and Viper configuration.
Usage
Describe your CLI tool requirements and get a structured Cobra implementation guide.
Examples
- "Set up a Cobra CLI with subcommands and global flags"
- "Add Viper config file support to my Go CLI"
- "How do I generate shell completions with Cobra?"
Guidelines
- Use Cobra for command structure and Viper for config management
- Show proper command hierarchy with persistent and local flags
- Cover configuration precedence: flags > env > config file > defaults
- Include shell completion generation for bash, zsh, and fish
- Explain testing strategies for CLI commands