__fish_complete_command: Fix --foo= logic

This was already supposed to handle `--foo=bar<TAB>` cases, except it
printed the `--foo=` again, causing fish to take that as part of the
token.

See #9538 for a similar thing with __fish_complete_directories.

Fixes #10011

(cherry picked from commit b03327f5d2)
This commit is contained in:
Fabian Boehm 2023-09-10 18:11:23 +02:00
parent 1119f68e66
commit 57bd21e7ce
2 changed files with 5 additions and 1 deletions

View file

@ -3,7 +3,7 @@ function __fish_complete_command --description 'Complete using all available com
switch $ctoken
case '*=*'
set ctoken (string split "=" -- $ctoken)
printf '%s\n' $ctoken[1]=(complete -C "$ctoken[2]")
complete -C "$ctoken[2]"
case '-*' # do not try to complete options as commands
return
case '*'

View file

@ -532,3 +532,7 @@ begin
end
rm -r $tmpdir
complete -C'complete --command=fish' | head -n 1 | string replace -rf '\t.*' ''
# (one "--command=" is okay, we used to get "--command=--command="
# CHECK: --command=fish