Skip to content

Commit 81f9145

Browse files
committed
Refactor code
1 parent 8227be1 commit 81f9145

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

command.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,7 @@ func (c *Command) VisibleCommands() []*Command {
309309
// VisibleFlagCategories returns a slice containing all the visible flag categories with the flags they contain
310310
func (c *Command) VisibleFlagCategories() []VisibleFlagCategory {
311311
if c.flagCategories == nil {
312-
c.flagCategories = newFlagCategories()
313-
for _, fl := range c.Flags {
314-
if cf, ok := fl.(CategorizableFlag); ok {
315-
if cf.GetCategory() != "" {
316-
c.flagCategories.AddFlag(cf.GetCategory(), cf)
317-
}
318-
}
319-
}
312+
c.flagCategories = newFlagCategoriesFromFlags(c.Flags)
320313
}
321314
return c.flagCategories.VisibleCategories()
322315
}

0 commit comments

Comments
 (0)