1 if ! (( $+commands[rustup] && $+commands[cargo] )); then
5 # If the completion file doesn't exist yet, we need to autoload it and
6 # bind it to `cargo`. Otherwise, compinit will have already done that
7 if [[ ! -f "$ZSH_CACHE_DIR/completions/_cargo" ]]; then
13 # If the completion file doesn't exist yet, we need to autoload it and
14 # bind it to `rustup`. Otherwise, compinit will have already done that
15 if [[ ! -f "$ZSH_CACHE_DIR/completions/_rustup" ]]; then
18 _comps[rustup]=_rustup
21 # Generate completion files in the background
22 rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
23 cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
25 source "$(rustc +${${(z)$(rustup default)}[1]} --print sysroot)"/share/zsh/site-functions/_cargo