VisibleCategories returns a slice of categories and commands that are Hidden=false
()
| 247 | // VisibleCategories returns a slice of categories and commands that are |
| 248 | // Hidden=false |
| 249 | func (cmd *Command) VisibleCategories() []CommandCategory { |
| 250 | ret := []CommandCategory{} |
| 251 | for _, category := range cmd.categories.Categories() { |
| 252 | if visible := func() CommandCategory { |
| 253 | if len(category.VisibleCommands()) > 0 { |
| 254 | return category |
| 255 | } |
| 256 | return nil |
| 257 | }(); visible != nil { |
| 258 | ret = append(ret, visible) |
| 259 | } |
| 260 | } |
| 261 | return ret |
| 262 | } |
| 263 | |
| 264 | // VisibleCommands returns a slice of the Commands with Hidden=false |
| 265 | func (cmd *Command) VisibleCommands() []*Command { |