go-flag-cobra
Installation
SKILL.md
Go Flags, Cobra & Viper
Source: https://pkg.go.dev/flag, https://github.com/spf13/cobra, https://github.com/spf13/viper
Purpose
Three-tier stack for Go CLI applications:
| Layer | Package | Role |
|---|---|---|
| Flag parsing | flag (stdlib) |
Basic -flag parsing for simple tools |
| CLI structure | cobra |
Subcommands, POSIX flags, help, autocomplete |
| Configuration | viper |
Merge config from files, env vars, flags, remote stores |
Cobra + Viper together form the standard Go CLI backbone (used by Kubernetes, Hugo, GitHub CLI).