Skip to content

Commit

Permalink
Bug: Don't print usage when errors occur in RunE
Browse files Browse the repository at this point in the history
  • Loading branch information
zsrv committed Apr 17, 2023
1 parent bbbf24c commit 5d19ff0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/root.go
Expand Up @@ -16,6 +16,11 @@ var rootCmd = &cobra.Command{
Use: "supermicro-product-key",
Short: "Supermicro Product Key Utility",
Version: build.Version(),
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Stops usage from printing for errors in RunE, while still allowing
// usage to print for cobra errors (e.g. Args count mismatch)
cmd.SilenceUsage = true
},
}

// Execute adds all child commands to the root command and sets flags appropriately.
Expand Down

0 comments on commit 5d19ff0

Please sign in to comment.