From 81f9145708bf1c5409d15f6308037effbe01cdf9 Mon Sep 17 00:00:00 2001 From: Naveen Gogineni Date: Fri, 7 Oct 2022 11:17:09 -0500 Subject: [PATCH] Refactor code --- command.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/command.go b/command.go index 0707044732..037ebc52c9 100644 --- a/command.go +++ b/command.go @@ -309,14 +309,7 @@ func (c *Command) VisibleCommands() []*Command { // VisibleFlagCategories returns a slice containing all the visible flag categories with the flags they contain func (c *Command) VisibleFlagCategories() []VisibleFlagCategory { if c.flagCategories == nil { - c.flagCategories = newFlagCategories() - for _, fl := range c.Flags { - if cf, ok := fl.(CategorizableFlag); ok { - if cf.GetCategory() != "" { - c.flagCategories.AddFlag(cf.GetCategory(), cf) - } - } - } + c.flagCategories = newFlagCategoriesFromFlags(c.Flags) } return c.flagCategories.VisibleCategories() }