Skip to content

Commit

Permalink
bash: hide hidden subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Mar 27, 2020
1 parent cd7fa10 commit c02dc39
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions carapace.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ func addCompletionCommand(cmd *cobra.Command) {
if args[0] == "bash" { // TODO print for other shells as well?
subcommands := make([]string, 0)
for _, c := range targetCmd.Commands() {
subcommands = append(subcommands, c.Name())
for _, alias := range c.Aliases {
subcommands = append(subcommands, alias)
if !c.Hidden {
subcommands = append(subcommands, c.Name())
for _, alias := range c.Aliases {
subcommands = append(subcommands, alias)
}
}
}
fmt.Println(ActionValues(subcommands...).Bash)
Expand Down

0 comments on commit c02dc39

Please sign in to comment.