COBRA-CLI-ADD(1)
π COBRA-CLI-ADD π
okay so this is cobra-cli-add from the Cobra Manual (man page COBRA-CLI-ADD(1), bestie, we're doing this) β and literally it's the command that gives your CLI app a brand new baby subcommand. it's giving main character energy for your project structure. π
β¨ NAME β¨
cobra-cli-add β Add a command to a Cobra Application
πΈ SYNOPSIS πΈ
cobra add [COMMAND NAME] [OPTIONS]
π¦ DESCRIPTION π¦
so like. cobra-cli add (yes, the binary is cobra-cli, the subcommand is add, we contain multitudes) will create a new command, with a license and the appropriate structure for a Cobra-based CLI application, and register it to its parent (default RootCmd). no cap, it literally scaffolds the whole thing for you. π
if you want your command to be public, pass in the command name with an initial uppercase letter. that's the vibe check β capital letter = public, lowercase = private. iykyk. π₯
example, and yes this is exact:
cobra-cli add server -> resulting in a new cmd/server.go
slay. a whole file. just like that. β¨
π ALIASES π
add, command
π OPTIONS π
-h,--helpβ help foradd. your little safety net, we love her. π«Ά-p,--parentstring β variable name of parent command for this command (default"rootCmd"). this is who your new command calls mom. πΌ
π OPTIONS INHERITED FROM PARENT COMMAND π
these come from the parent, not from add itself, so don't come for me about it bestie, i'm just relaying the facts:
-a,--authorstring β author name for copyright attribution (default"YOUR NAME"). yes literally the default isYOUR NAME, they're not gonna fill it in for you π--configstring β config file (default is$HOME/.cobra.yaml). it lives in your home dir, iconic behavior. π-l,--licensestring β name of license for the project. pick one, any one, but like, pick one. β--viperβ Use Viper for configuration. turn this on if you want that config-management energy. π
π SEE ALSO π
okay that's the whole page, no notes. this was github.com/spf13/cobra-cli, dated Mar 2022, and honestly? she ate. periodt. πβ¨π¦πΈπ
π¦ where this page comes from
- debian bookworm: cobra-cli 1.3.0-3+b5 Β· Apache-2.0
- debian trixie: cobra-cli 1.3.0-3+b17 Β· Apache-2.0
- ubuntu noble: cobra-cli 1.3.0-3build1 Β· Apache-2.0
- ubuntu noble: cobra-cli 1.3.0-3ubuntu0.24.04.3 Β· Apache-2.0
- ubuntu resolute: cobra-cli 1.3.0-3build2 Β· Apache-2.0
- ubuntu stonking: cobra-cli 1.3.0-3build2 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms