From deb6d477d4f818fc0de0976855cc46bcee1bf1d1 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 20 Sep 2018 18:59:57 -0500 Subject: [PATCH] Escape parameters in `rustc` completions Closes #5057. --- share/completions/rustc.fish | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/share/completions/rustc.fish b/share/completions/rustc.fish index 27cb6498e..17dc499a5 100644 --- a/share/completions/rustc.fish +++ b/share/completions/rustc.fish @@ -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