Skip to content

Commit 6f37f6a

Browse files
authored
Merge pull request urfave#2114 from bittrance/fish-completion-no-files
Avoid suggesting files in fish command completions.
2 parents de2b0d1 + 74f70ee commit 6f37f6a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

fish.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func (cmd *Command) prepareFishCommands(commands []*Command, allCommands *[]stri
6969
for _, command := range commands {
7070
var completion strings.Builder
7171
fmt.Fprintf(&completion,
72-
"complete -r -c %s -n '%s' -a '%s'",
72+
"complete -x -c %s -n '%s' -a '%s'",
7373
cmd.Name,
7474
cmd.fishSubcommandHelper(previousCommands, commands),
7575
strings.Join(command.Names(), " "),

testdata/expected-fish-full.fish

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ complete -c greet -n '__fish_greet_no_subcommand' -l foofile -r
1717
complete -c greet -n '__fish_greet_no_subcommand' -f -l help -s h -d 'show help'
1818
complete -c greet -n '__fish_greet_no_subcommand' -f -l version -s v -d 'print the version'
1919
complete -c greet -n '__fish_seen_subcommand_from config c' -f -l help -s h -d 'show help'
20-
complete -r -c greet -n '__fish_greet_no_subcommand' -a 'config c' -d 'another usage test'
20+
complete -x -c greet -n '__fish_greet_no_subcommand' -a 'config c' -d 'another usage test'
2121
complete -c greet -n '__fish_seen_subcommand_from config c' -l flag -s fl -s f -r
2222
complete -c greet -n '__fish_seen_subcommand_from config c' -f -l another-flag -s b -d 'another usage text'
2323
complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l help -s h -d 'show help'
24-
complete -r -c greet -n '__fish_seen_subcommand_from config c; and not __fish_seen_subcommand_from sub-config s ss' -a 'sub-config s ss' -d 'another usage test'
24+
complete -x -c greet -n '__fish_seen_subcommand_from config c; and not __fish_seen_subcommand_from sub-config s ss' -a 'sub-config s ss' -d 'another usage test'
2525
complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-flag -s sub-fl -s s -r
2626
complete -c greet -n '__fish_seen_subcommand_from sub-config s ss' -f -l sub-command-flag -s s -d 'some usage text'
2727
complete -c greet -n '__fish_seen_subcommand_from info i in' -f -l help -s h -d 'show help'
28-
complete -r -c greet -n '__fish_greet_no_subcommand' -a 'info i in' -d 'retrieve generic information'
28+
complete -x -c greet -n '__fish_greet_no_subcommand' -a 'info i in' -d 'retrieve generic information'
2929
complete -c greet -n '__fish_seen_subcommand_from some-command' -f -l help -s h -d 'show help'
30-
complete -r -c greet -n '__fish_greet_no_subcommand' -a 'some-command'
30+
complete -x -c greet -n '__fish_greet_no_subcommand' -a 'some-command'
3131
complete -c greet -n '__fish_seen_subcommand_from usage u' -f -l help -s h -d 'show help'
32-
complete -r -c greet -n '__fish_greet_no_subcommand' -a 'usage u' -d 'standard usage text'
32+
complete -x -c greet -n '__fish_greet_no_subcommand' -a 'usage u' -d 'standard usage text'
3333
complete -c greet -n '__fish_seen_subcommand_from usage u' -l flag -s fl -s f -r
3434
complete -c greet -n '__fish_seen_subcommand_from usage u' -f -l another-flag -s b -d 'another usage text'
3535
complete -c greet -n '__fish_seen_subcommand_from sub-usage su' -f -l help -s h -d 'show help'
36-
complete -r -c greet -n '__fish_seen_subcommand_from usage u; and not __fish_seen_subcommand_from sub-usage su' -a 'sub-usage su' -d 'standard usage text'
36+
complete -x -c greet -n '__fish_seen_subcommand_from usage u; and not __fish_seen_subcommand_from sub-usage su' -a 'sub-usage su' -d 'standard usage text'
3737
complete -c greet -n '__fish_seen_subcommand_from sub-usage su' -f -l sub-command-flag -s s -d 'some usage text'

0 commit comments

Comments
 (0)