mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:57:30 +08:00
__fish_seen_subcommand_from: Fix error when there's no second token
Regression from 2bfa7db7bc
Can be triggered e.g. with `complete -C"history "`.
This commit is contained in:
parent
5f9e9cbe74
commit
bd5f9babd7
|
@ -6,5 +6,5 @@
|
|||
|
||||
function __fish_seen_subcommand_from
|
||||
set -l regex (string escape --style=regex -- (commandline -pxc)[2..] | string join '|')
|
||||
string match -rq -- '^'$regex'$' $argv
|
||||
string match -rq -- "^$regex"'$' $argv
|
||||
end
|
||||
|
|
|
@ -614,3 +614,10 @@ function __fish_describe_command
|
|||
end
|
||||
test (count (complete -C"wh" | string match -rv "\tcommand|^while")) -gt 0 && echo "found" || echo "fail"
|
||||
# CHECK: found
|
||||
|
||||
set -l commands check search show
|
||||
complete -c testcommand -n "not __fish_seen_subcommand_from $commands" -a 'check\t"Check the frobnicator" search\t"Search for frobs" show\t"Show all frobs"'
|
||||
complete -C'testcommand '
|
||||
# CHECK: check{{\t}}Check the frobnicator
|
||||
# CHECK: search{{\t}}Search for frobs
|
||||
# CHECK: show{{\t}}Show all frobs
|
||||
|
|
Loading…
Reference in New Issue
Block a user