Skip to content

Commit

Permalink
Merge pull request #891 from saschagrunert/fish-hidden
Browse files Browse the repository at this point in the history
Don't generate fish completion for hidden commands
  • Loading branch information
asahasrabuddhe authored Sep 11, 2019
2 parents e19126a + 6d888d6 commit 388c2dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ func testApp() *App {
Usage: "retrieve generic information",
}, {
Name: "some-command",
}, {
Name: "hidden-command",
Hidden: true,
}}
app.UsageText = "app [first_arg] [second_arg]"
app.Usage = "Some app"
Expand Down
4 changes: 4 additions & 0 deletions fish.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func (a *App) prepareFishCommands(commands []Command, allCommands *[]string, pre
for i := range commands {
command := &commands[i]

if command.Hidden {
continue
}

var completion strings.Builder
completion.WriteString(fmt.Sprintf(
"complete -r -c %s -n '%s' -a '%s'",
Expand Down

0 comments on commit 388c2dd

Please sign in to comment.