COBRA-ADD(1)
β¨ COBRA-ADD(1) β¨
okay bestie, welcome to the Cobra Manual π
this is the page for cobra-add, and yes it's giving main character energy, let's get into it
πΈ NAME πΈ
cobra-add β add a command to a Cobra Application π¦
π SYNOPSIS π
cobra add [OPTIONS]
π DESCRIPTION π
okay so, cobra add is literally gonna create a brand new command for you. like, it makes the whole thing: the command itself, a license, and the appropriate structure for a Cobra-based CLI application, and then it registers that baby to its parent (which defaults to RootCmd, iykyk). π«Ά
and here's the tea, bestie: if you want your command to be public, you gotta pass in the command name with an initial uppercase letter. no cap. π
Example: cobra add server -> resulting in a new cmd/server.go β¨
π₯ OPTIONS π₯
-p,--parent="RootCmd"β name of parent command for this command, fr fr
π OPTIONS INHERITED FROM PARENT COMMANDS π
these ones you get from the parent commands, they're not even yours but they're iconic
-a,--author="YOUR NAME"β author name for copyright attribution, put ur name on it bestie π--config=""β config file (default is$HOME/.cobra.yaml) π-l,--license=""β name of license for the project (can providelicensetextin config)-b,--projectbase=""β base project directory, e.g.github.com/spf13/--viper[=true]β use Viper for configuration π
π SEE ALSO π
not me ending this page but the vibes were immaculate the entire time ππ
okay that's the whole page, so go forth and cobra add something slay. this was written in Dec 2015 and lives over at github.com/spf13/cobra β mwah, stan, periodt πβ¨π¦
π¦ where this page comes from
- ubuntu jammy: cobra 1.3.0-1 Β· Apache-2.0
- ubuntu jammy: cobra 1.3.0-1ubuntu0.3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms