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 for add. your little safety net, we love her. 🫢
  • -p, --parent string β€” 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, --author string β€” author name for copyright attribution (default "YOUR NAME"). yes literally the default is YOUR NAME, they're not gonna fill it in for you 😭
  • --config string β€” config file (default is $HOME/.cobra.yaml). it lives in your home dir, iconic behavior. 🏠
  • -l, --license string β€” 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. πŸ’–βœ¨πŸ¦‹πŸŒΈπŸŽ€