1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-17 19:30:10 +00:00

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.
This commit is contained in:
Joey Territo 2022-01-08 14:03:32 -05:00 committed by GitHub
parent 71e6d5fde8
commit c6e7f8905f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,5 +27,5 @@ fi
rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &| rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF' cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
#compdef cargo #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 EOF