Escape parameters in rustc completions

Closes #5057.
This commit is contained in:
Mahmoud Al-Qudsi 2018-09-20 18:59:57 -05:00
parent 38ac7693e9
commit deb6d477d4

View file

@ -33,7 +33,7 @@ for line in $rust_docs
set docs (string split -m 1 ' ' $line)
set flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \
$docs[1])
complete -c rustc -x -s C -l codegen -a "$flag" -d "$docs[2]"
complete -c rustc -x -s C -l codegen -a (string escape -- "$flag") -d "$docs[2]"
end
# rustc -Z is only available with the nightly toolchain, which may not be installed
@ -47,7 +47,7 @@ if rustc +nightly >/dev/null 2>&1
set docs (string split -m 1 ' ' $line)
set flag (string replace -r '^([a-z\-]+\=|[a-z\-]+)(.*)' '$1' \
$docs[1])
complete -c rustc -x -s Z -a "$flag" -d "$docs[2]"
complete -c rustc -x -s Z -a (string escape -- "$flag") -d "$docs[2]"
end
end
@ -62,10 +62,10 @@ set -l rust_docs (rustc -W help \
for line in $rust_docs
set docs (string split -m 1 ' ' $line)
complete -c rustc -x -s W -l warn -a "$docs[1]" -d "$docs[2]"
complete -c rustc -x -s A -l allow -a "$docs[1]" -d "$docs[2]"
complete -c rustc -x -s D -l deny -a "$docs[1]" -d "$docs[2]"
complete -c rustc -x -s F -l forbid -a "$docs[1]" -d "$docs[2]"
complete -c rustc -x -s W -l warn -a (string escape -- "$docs[1]") -d "$docs[2]"
complete -c rustc -x -s A -l allow -a (string escape -- "$docs[1]") -d "$docs[2]"
complete -c rustc -x -s D -l deny -a (string escape -- "$docs[1]") -d "$docs[2]"
complete -c rustc -x -s F -l forbid -a (string escape -- "$docs[1]") -d "$docs[2]"
end
set -e rust_codegen