Refactor code
This commit is contained in:
parent
8227be1fe9
commit
81f9145708
@ -309,14 +309,7 @@ func (c *Command) VisibleCommands() []*Command {
|
|||||||
// VisibleFlagCategories returns a slice containing all the visible flag categories with the flags they contain
|
// VisibleFlagCategories returns a slice containing all the visible flag categories with the flags they contain
|
||||||
func (c *Command) VisibleFlagCategories() []VisibleFlagCategory {
|
func (c *Command) VisibleFlagCategories() []VisibleFlagCategory {
|
||||||
if c.flagCategories == nil {
|
if c.flagCategories == nil {
|
||||||
c.flagCategories = newFlagCategories()
|
c.flagCategories = newFlagCategoriesFromFlags(c.Flags)
|
||||||
for _, fl := range c.Flags {
|
|
||||||
if cf, ok := fl.(CategorizableFlag); ok {
|
|
||||||
if cf.GetCategory() != "" {
|
|
||||||
c.flagCategories.AddFlag(cf.GetCategory(), cf)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return c.flagCategories.VisibleCategories()
|
return c.flagCategories.VisibleCategories()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user