fish.go: support PathFlag.TakesFile [#1156]
This commit is contained in:
parent
4f74020d9f
commit
5bb54ace57
4
fish.go
4
fish.go
@ -171,6 +171,10 @@ func fishAddFileFlag(flag Flag, completion *strings.Builder) {
|
||||
if f.TakesFile {
|
||||
return
|
||||
}
|
||||
case *PathFlag:
|
||||
if f.TakesFile {
|
||||
return
|
||||
}
|
||||
}
|
||||
completion.WriteString(" -f")
|
||||
}
|
||||
|
@ -7,6 +7,10 @@ import (
|
||||
func TestFishCompletion(t *testing.T) {
|
||||
// Given
|
||||
app := testApp()
|
||||
app.Flags = append(app.Flags, &PathFlag{
|
||||
Name: "logfile",
|
||||
TakesFile: true,
|
||||
})
|
||||
|
||||
// When
|
||||
res, err := app.ToFishCompletion()
|
||||
|
1
testdata/expected-fish-full.fish
vendored
1
testdata/expected-fish-full.fish
vendored
@ -12,6 +12,7 @@ end
|
||||
complete -c greet -n '__fish_greet_no_subcommand' -l socket -s s -r -d 'some \'usage\' text'
|
||||
complete -c greet -n '__fish_greet_no_subcommand' -f -l flag -s fl -s f -r
|
||||
complete -c greet -n '__fish_greet_no_subcommand' -f -l another-flag -s b -d 'another usage text'
|
||||
complete -c greet -n '__fish_greet_no_subcommand' -l logfile -r
|
||||
complete -c greet -n '__fish_greet_no_subcommand' -f -l help -s h -d 'show help'
|
||||
complete -c greet -n '__fish_greet_no_subcommand' -f -l version -s v -d 'print the version'
|
||||
complete -c greet -n '__fish_seen_subcommand_from config c' -f -l help -s h -d 'show help'
|
||||
|
Loading…
Reference in New Issue
Block a user