2021-09-07 18:02:20 +00:00
|
|
|
if (( $+commands[rustup] )); then
|
2021-09-15 16:47:51 +00:00
|
|
|
# remove old generated completion file
|
|
|
|
command rm -f "${0:A:h}/_rustup"
|
|
|
|
|
2021-09-15 16:18:25 +00:00
|
|
|
ver="$(rustup --version 2>/dev/null)"
|
|
|
|
ver_file="$ZSH_CACHE_DIR/rustup_version"
|
2021-09-15 16:41:44 +00:00
|
|
|
comp_file="$ZSH_CACHE_DIR/completions/_rustup"
|
|
|
|
|
|
|
|
mkdir -p "${comp_file:h}"
|
|
|
|
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
|
2021-09-15 16:18:25 +00:00
|
|
|
|
|
|
|
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
|
|
|
|
rustup completions zsh >| "$comp_file"
|
|
|
|
echo "$ver" >| "$ver_file"
|
2021-09-07 18:02:20 +00:00
|
|
|
fi
|
2021-09-15 16:18:25 +00:00
|
|
|
|
|
|
|
declare -A _comps
|
2021-09-07 18:02:20 +00:00
|
|
|
autoload -Uz _rustup
|
|
|
|
_comps[rustup]=_rustup
|
2021-09-15 16:18:25 +00:00
|
|
|
|
|
|
|
unset ver ver_file comp_file
|
2021-09-07 18:02:20 +00:00
|
|
|
fi
|