mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-19 18:01:15 -03:00
completions: fix double evaluation of tokenized commandline
Fix cases like
eval my-cmd (commandline -o)
complete -C "my-cmd $(commandline -o)"
In both cases, we spuriously evaluate tokens like "(inside-quoted-string)"
as command substitutions. Fix this by escaping the strings. The momentarily
regresses the intended purpose of "eval" -- to expand variables -- but the
next commit will fix that.
This commit is contained in:
@@ -18,7 +18,7 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowin
|
||||
set -l options_with_param $argv
|
||||
|
||||
if not string length -q -- $subcommand
|
||||
set -l cmd (commandline -cop) (commandline -ct)
|
||||
set -l cmd (commandline -cop | string escape) (commandline -ct)
|
||||
while set -q cmd[1]
|
||||
set -l token $cmd[1]
|
||||
set -e cmd[1]
|
||||
|
||||
Reference in New Issue
Block a user