Merge pull request #1499 from dearchap/issue_557
Fix help results inconsistency
This commit is contained in:
11
command.go
11
command.go
@@ -170,7 +170,7 @@ func (c *Command) Run(ctx *Context) (err error) {
|
||||
}
|
||||
|
||||
if c.Action == nil {
|
||||
c.Action = helpSubcommand.Action
|
||||
c.Action = helpCommand.Action
|
||||
}
|
||||
|
||||
cCtx.Command = c
|
||||
@@ -284,7 +284,7 @@ func (c *Command) startApp(ctx *Context) error {
|
||||
if c.Action != nil {
|
||||
app.Action = c.Action
|
||||
} else {
|
||||
app.Action = helpSubcommand.Action
|
||||
app.Action = helpCommand.Action
|
||||
}
|
||||
app.OnUsageError = c.OnUsageError
|
||||
|
||||
@@ -298,7 +298,12 @@ func (c *Command) startApp(ctx *Context) error {
|
||||
// VisibleFlagCategories returns a slice containing all the visible flag categories with the flags they contain
|
||||
func (c *Command) VisibleFlagCategories() []VisibleFlagCategory {
|
||||
if c.flagCategories == nil {
|
||||
return []VisibleFlagCategory{}
|
||||
c.flagCategories = newFlagCategories()
|
||||
for _, fl := range c.Flags {
|
||||
if cf, ok := fl.(CategorizableFlag); ok {
|
||||
c.flagCategories.AddFlag(cf.GetCategory(), cf)
|
||||
}
|
||||
}
|
||||
}
|
||||
return c.flagCategories.VisibleCategories()
|
||||
}
|
||||
|
Reference in New Issue
Block a user