Skip to content

Commit

Permalink
fish: hide hidden subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Mar 27, 2020
1 parent c02dc39 commit 9a40d73
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fish/snippet.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ func snippetFunctions(cmd *cobra.Command, actions map[string]string) string {
if cmd.HasSubCommands() {
positionals = []string{}
for _, subcmd := range cmd.Commands() {
positionals = append(positionals, fmt.Sprintf(`complete -c %v -f -n '_%v_state %v ' -a '%v' -d '%v'`, cmd.Root().Name(), cmd.Root().Name(), uid.Command(cmd), subcmd.Name() + " " + strings.Join(subcmd.Aliases, " "), subcmd.Short))
// TODO filter hidden
if !subcmd.Hidden {
positionals = append(positionals, fmt.Sprintf(`complete -c %v -f -n '_%v_state %v ' -a '%v' -d '%v'`, cmd.Root().Name(), cmd.Root().Name(), uid.Command(cmd), subcmd.Name()+" "+strings.Join(subcmd.Aliases, " "), subcmd.Short))
}
}
} else {
if len(positionals) == 0 {
Expand Down

0 comments on commit 9a40d73

Please sign in to comment.