Skip to content

Commit

Permalink
mixer: avoid extra output when mixer fails
Browse files Browse the repository at this point in the history
RunE will show the error returned at each command in the tree, which
means most of our commands will be showing the error twice. Setting
SilenceErrors disables this behavior.

RunE will show the usage when an error happens, which most of the time
is just "spam" since the call might be correct and the error happened
during the execution of the command.

Before this patch a failure looked like

    $ mixer add-rpms
    Mixer 3.2.1
    Error: RPMDIR not set in configuration
    Usage:
      mixer add-rpms [flags]

    Flags:
      -c, --config string   Builder config to use
      -h, --help            help for add-rpms

    Mixer Error: RPMDIR not set in configuration

and after the patch it looks like

    $ mixer add-rpms
    Mixer 3.2.1
    Mixer Error: RPMDIR not set in configuration

Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
  • Loading branch information
cmarcelo committed Jan 3, 2018
1 parent c28afb8 commit 2d255d1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mixer/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ var config string
var RootCmd = &cobra.Command{
Use: "mixer",
Long: `Mixer is a tool used to compose OS update content and images.`,

SilenceUsage: true,
SilenceErrors: true,
}

type initCmdFlags struct {
Expand Down

0 comments on commit 2d255d1

Please sign in to comment.