From c6e7f8905fb61b927f12f43fb57f8c514cd48a67 Mon Sep 17 00:00:00 2001 From: Joey Territo <54502648+jtt9340@users.noreply.github.com> Date: Sat, 8 Jan 2022 14:03:32 -0500 Subject: [PATCH] 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. --- plugins/rust/rust.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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