__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
This commit is contained in:
Fabian Boehm 2023-09-10 18:11:23 +02:00
parent fc95eca257
commit b03327f5d2
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

@ -548,3 +548,7 @@ complete -C'dotty '
# CHECK: .abc
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