mirror of
https://github.com/spf13/cobra
synced 2024-12-27 14:57:06 +00:00
[silence-errors]: adds comments around code
This commit is contained in:
parent
4729b374ae
commit
2244c3923a
1 changed files with 4 additions and 1 deletions
|
@ -639,10 +639,13 @@ func (c *Command) Execute() (err error) {
|
|||
|
||||
err = cmd.execute(flags)
|
||||
if err != nil {
|
||||
// If root is silenced, all subcommands should have the same
|
||||
// If root command has SilentUsage flagged,
|
||||
// all subcommands should respect it
|
||||
if !cmd.SilenceUsage && !c.SilenceUsage {
|
||||
c.Println(cmd.UsageString())
|
||||
}
|
||||
// If root command has SilentErrors flagged,
|
||||
// all subcommands should respect it
|
||||
if !cmd.SilenceErrors && !c.SilenceErrors {
|
||||
if err == flag.ErrHelp {
|
||||
cmd.HelpFunc()(cmd, args)
|
||||
|
|
Loading…
Reference in a new issue