Skip to content

Commit

Permalink
reset annotations and fix suggestion sort
Browse files Browse the repository at this point in the history
  • Loading branch information
brianstrauch committed Dec 5, 2023
1 parent 280eef2 commit b7201a1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ func execute(cmd *cobra.Command, args []string) error {
} else {
_ = flag.Value.Set(flag.DefValue)
}

_ = cmd.Flags().SetAnnotation(flag.Name, cobra.BashCompOneRequiredFlag, []string{"false"})
})

cmd.InitDefaultHelpFlag()
Expand Down Expand Up @@ -212,7 +214,15 @@ func parseSuggestions(out string) []prompt.Suggest {
return it < jt
}

return isFlag(jt) || !isFlag(it) || it < jt
if isFlag(it) {
return false
}

if isFlag(jt) {
return true
}

return it < jt
})

return suggestions
Expand Down

0 comments on commit b7201a1

Please sign in to comment.