Skip to content
This repository has been archived by the owner on Aug 12, 2021. It is now read-only.

Commit

Permalink
Don't display usage info when a command returns with an error
Browse files Browse the repository at this point in the history
Just display the error and exit the program.

Signed-off-by: Jan Dubois <jan.dubois@suse.com>
  • Loading branch information
jandubois committed Apr 23, 2021
1 parent dbe7e1c commit 4a11491
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ var (
as well as a lightweight control program to create/access/delete virtual machines
running via hyperkit.`,
Version: hyperkit.GetVersion(),
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// Don't display usage information when a RunE command returns an error.
// Just print the error and exit.
cmd.SilenceUsage = true
},
}
)

Expand Down

0 comments on commit 4a11491

Please sign in to comment.