Merge pull request #1198 from ErinCall/paths-take-files
Support PathFlag.TakesFile in fish completion
This commit is contained in:
commit
3be15f7525
4
fish.go
4
fish.go
@ -171,6 +171,10 @@ func fishAddFileFlag(flag Flag, completion *strings.Builder) {
|
|||||||
if f.TakesFile {
|
if f.TakesFile {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
case *PathFlag:
|
||||||
|
if f.TakesFile {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
completion.WriteString(" -f")
|
completion.WriteString(" -f")
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,10 @@ import (
|
|||||||
func TestFishCompletion(t *testing.T) {
|
func TestFishCompletion(t *testing.T) {
|
||||||
// Given
|
// Given
|
||||||
app := testApp()
|
app := testApp()
|
||||||
|
app.Flags = append(app.Flags, &PathFlag{
|
||||||
|
Name: "logfile",
|
||||||
|
TakesFile: true,
|
||||||
|
})
|
||||||
|
|
||||||
// When
|
// When
|
||||||
res, err := app.ToFishCompletion()
|
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' -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 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' -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 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_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'
|
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