# cobra Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.
Usage: cobra [command]
Available Commands: add Add a command to a Cobra Application help Help about any command init Initialize a Cobra Application
Flags: -a, --author string author name for copyright attribution (default "YOUR NAME") --config string config file (default is $HOME/.cobra.yaml) -h, --helphelpfor cobra -l, --license string name of license for the project --viper use Viper for configuration (default true)
Use "cobra [command] --help"for more information about a command.
# cobra init --help Initialize (cobra init) will create a new application, with a license and the appropriate structure for a Cobra-based CLI application.
* If a name is provided, it will be created in the current directory; * If no name is provided, the current directory will be assumed; * If a relative path is provided, it will be created inside $GOPATH (e.g. github.com/spf13/hugo); * If an absolute path is provided, it will be created; * If the directory already exists but is empty, it will be used.
Init will not use an existing directory with contents.
Usage: cobra init [name] [flags]
Aliases: init, initialize, initialise, create
Flags: -h, --helphelpfor init --pkg-name string fully qualified pkg name
Global Flags: -a, --author string author name for copyright attribution (default "YOUR NAME") --config string config file (default is $HOME/.cobra.yaml) -l, --license string name of license for the project --viper use Viper for configuration (default true)
# cobra add --help Add (cobra add) 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).
If you want your command to be public, pass in the command name with an initial uppercase letter.
Example: cobra add server -> resulting in a new cmd/server.go
Usage: cobra add [command name] [flags]
Aliases: add, command
Flags: -h, --helphelpfor add -p, --parent string variable name of parent commandfor this command (default "rootCmd")
Global Flags: -a, --author string author name for copyright attribution (default "YOUR NAME") --config string config file (default is $HOME/.cobra.yaml) -l, --license string name of license for the project --viper use Viper for configuration (default true)