mirror of https://github.com/spf13/cobra.git
adds inheritance for SilenceErrors
This commit is contained in:
parent
f6e1a2df92
commit
03aabcda72
|
@ -637,7 +637,8 @@ func (c *Command) Execute() (err error) {
|
||||||
|
|
||||||
err = cmd.execute(flags)
|
err = cmd.execute(flags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !cmd.SilenceErrors {
|
// If root is silenced, all subcommands should have the same
|
||||||
|
if !cmd.SilenceErrors && !c.SilenceErrors {
|
||||||
if err == flag.ErrHelp {
|
if err == flag.ErrHelp {
|
||||||
cmd.HelpFunc()(cmd, args)
|
cmd.HelpFunc()(cmd, args)
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue