Don't generate fish completion for hidden commands
Added the missing test case as well. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
This commit is contained in:
parent
b207e20873
commit
bac5bde38c
@ -53,6 +53,9 @@ func testApp() *App {
|
|||||||
Usage: "retrieve generic information",
|
Usage: "retrieve generic information",
|
||||||
}, {
|
}, {
|
||||||
Name: "some-command",
|
Name: "some-command",
|
||||||
|
}, {
|
||||||
|
Name: "hidden-command",
|
||||||
|
Hidden: true,
|
||||||
}}
|
}}
|
||||||
app.UsageText = "app [first_arg] [second_arg]"
|
app.UsageText = "app [first_arg] [second_arg]"
|
||||||
app.Usage = "Some app"
|
app.Usage = "Some app"
|
||||||
|
4
fish.go
4
fish.go
@ -69,6 +69,10 @@ func (a *App) prepareFishCommands(commands []Command, allCommands *[]string, pre
|
|||||||
for i := range commands {
|
for i := range commands {
|
||||||
command := &commands[i]
|
command := &commands[i]
|
||||||
|
|
||||||
|
if command.Hidden {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
var completion strings.Builder
|
var completion strings.Builder
|
||||||
completion.WriteString(fmt.Sprintf(
|
completion.WriteString(fmt.Sprintf(
|
||||||
"complete -r -c %s -n '%s' -a '%s'",
|
"complete -r -c %s -n '%s' -a '%s'",
|
||||||
|
Loading…
Reference in New Issue
Block a user