summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Territo <54502648+jtt9340@users.noreply.github.com>2022-01-08 14:03:32 -0500
committerGitHub <noreply@github.com>2022-01-08 20:03:32 +0100
commitc6e7f8905fb61b927f12f43fb57f8c514cd48a67 (patch)
treec4fd8f4aca1fe6ac10f9894953fb4a6164febf80
parent71e6d5fde87be76205e87eed2e1a306a2f3bc5a8 (diff)
downloadzsh-c6e7f8905fb61b927f12f43fb57f8c514cd48a67.tar.gz
zsh-c6e7f8905fb61b927f12f43fb57f8c514cd48a67.tar.bz2
zsh-c6e7f8905fb61b927f12f43fb57f8c514cd48a67.zip
fix(rust): fix `cargo` completion when sysroot contains spaces (#10571)
When generating completions for Cargo, if the Rust sysroot (i.e. `rustc +${${(z)$(rustup default)}[1]} --print sysroot`) contains spaces, Cargo completions will not work because the spaces are not escaped, thus passing two arguments to the "source" command instead of one. The spaces need to be escaped for this to work.
-rw-r--r--plugins/rust/rust.plugin.zsh2
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/rust/rust.plugin.zsh b/plugins/rust/rust.plugin.zsh
index 465b701b0..db6ca9e74 100644
--- a/plugins/rust/rust.plugin.zsh
+++ b/plugins/rust/rust.plugin.zsh
@@ -27,5 +27,5 @@ fi
rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
#compdef cargo
-source $(rustc +${${(z)$(rustup default)}[1]} --print sysroot)/share/zsh/site-functions/_cargo
+source "$(rustc +${${(z)$(rustup default)}[1]} --print sysroot)"/share/zsh/site-functions/_cargo
EOF