Display usage when args are defined in an invalid way

This commit is contained in:
Nils Hanke 2022-05-04 18:42:13 +02:00 committed by Thomas Tendyck
parent 4459766b58
commit 2a6b1e2277

View File

@ -13,7 +13,7 @@ var rootCmd = &cobra.Command{
Use: "constellation",
Short: "Manage your Constellation cluster",
Long: "Manage your Constellation cluster.",
SilenceUsage: true,
PersistentPreRun: preRunRoot,
}
// Execute starts the CLI.
@ -64,6 +64,10 @@ func init() {
rootCmd.AddCommand(newVersionCmd())
}
func preRunRoot(cmd *cobra.Command, args []string) {
cmd.SilenceUsage = true
}
func must(err error) {
if err != nil {
panic(err)