Skip to content

Commit

Permalink
Final fix to recursive filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlandon committed Sep 7, 2023
1 parent 7ef7f8a commit b6f68d4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,10 @@ func (m *Menu) CheckIsAvailable(cmd *cobra.Command) error {
// does not declare as compliant with (added with console.Hide/ShowCommand()).
func (m *Menu) ActiveFiltersFor(cmd *cobra.Command) []string {
if cmd.Annotations == nil {
if cmd.HasParent() {
return m.ActiveFiltersFor(cmd.Parent())
}

return nil
}

Expand All @@ -244,7 +248,7 @@ func (m *Menu) ActiveFiltersFor(cmd *cobra.Command) []string {
}
}

if len(filters) > 0 {
if len(filters) > 0 || !cmd.HasParent() {
return filters
}

Expand Down

0 comments on commit b6f68d4

Please sign in to comment.