fix(core): move plugin-generated completion files to $ZSH_CACHE_DIR/completions

Fixes #10183
This commit is contained in:
Marc Cornellà 2021-09-15 18:41:44 +02:00
commit d2269180b0
No known key found for this signature in database
GPG key ID: 0314585E776A9C1B
6 changed files with 24 additions and 5 deletions

View file

@ -1,7 +1,10 @@
if (( $+commands[rustup] && $+commands[cargo] )); then
ver="$(cargo --version)"
ver_file="$ZSH_CACHE_DIR/cargo_version"
comp_file="$ZSH/plugins/cargo/_cargo"
comp_file="$ZSH_CACHE_DIR/completions/_cargo"
mkdir -p "${comp_file:h}"
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
rustup completions zsh cargo >| "$comp_file"