Fix HideHelp

This commit is contained in:
Dokiy
2022-07-29 15:26:06 +08:00
parent c8147a4845
commit 1a1b9cd563
4 changed files with 61 additions and 17 deletions

View File

@@ -125,7 +125,9 @@ func (c *Command) Run(ctx *Context) (err error) {
fmt.Fprintf(cCtx.App.Writer, suggestion)
}
}
_ = ShowCommandHelp(cCtx, c.Name)
if !c.HideHelp {
_ = ShowCommandHelp(cCtx, c.Name)
}
return err
}
@@ -135,7 +137,9 @@ func (c *Command) Run(ctx *Context) (err error) {
cerr := cCtx.checkRequiredFlags(c.Flags)
if cerr != nil {
_ = ShowCommandHelp(cCtx, c.Name)
if !c.HideHelp {
_ = ShowCommandHelp(cCtx, c.Name)
}
return cerr
}