COBRA-ADD(1)

πŸ“¦ version 1.3.0, in ubuntu jammy

✨ 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 provide licensetext in 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