completions: Use commandline -opc, not just -o

`commandline -o` tokenizes *the entire commandline buffer*.

See #6922.
This commit is contained in:
Fabian Homborg 2020-04-20 19:01:36 +02:00
parent 2421eb6180
commit 3f95440f26
2 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ function __fish_complete_npm -d "Complete the commandline using npm's 'completio
if command -sq npm
# npm completion is bash-centric, so we need to translate fish's "commandline" stuff to bash's $COMP_* stuff
# COMP_LINE is an array with the words in the commandline
set -lx COMP_LINE (commandline -o)
set -lx COMP_LINE (commandline -opc)
# COMP_CWORD is the index of the current word in COMP_LINE
# bash starts arrays with 0, so subtract 1
set -lx COMP_CWORD (math (count $COMP_LINE) - 1)

View File

@ -11,7 +11,7 @@ end
# Lists PHPUnit objects corresponding to the given option
function __fish_phpunit_list --argument option
# Use the same PHPUnit binary as in the command being completed
set -l phpunit (commandline -o)[1]
set -l phpunit (commandline -opc)[1]
test -x $phpunit
or return