fix: automatically create completion for cargo and rustup plugins (#10087)

This commit is contained in:
Carlo Sala 2021-09-07 20:02:20 +02:00 committed by GitHub
commit 450acc0113
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 1550 deletions

View file

@ -0,0 +1,11 @@
# COMPLETION FUNCTION
if (( $+commands[rustup] && $+commands[cargo] )); then
if [[ ! -f $ZSH_CACHE_DIR/cargo_version ]] \
|| [[ "$(cargo --version)" != "$(< "$ZSH_CACHE_DIR/cargo_version")" ]] \
|| [[ ! -f $ZSH/plugins/cargo/_cargo ]]; then
rustup completions zsh cargo > $ZSH/plugins/cargo/_cargo
cargo --version > $ZSH_CACHE_DIR/cargo_version
fi
autoload -Uz _cargo
_comps[cargo]=_cargo
fi