rustup.plugin.zsh 538 B

12345678910111213141516171819
  1. if (( $+commands[rustup] )); then
  2. ver="$(rustup --version 2>/dev/null)"
  3. ver_file="$ZSH_CACHE_DIR/rustup_version"
  4. comp_file="$ZSH_CACHE_DIR/completions/_rustup"
  5. mkdir -p "${comp_file:h}"
  6. (( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
  7. if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
  8. rustup completions zsh >| "$comp_file"
  9. echo "$ver" >| "$ver_file"
  10. fi
  11. declare -A _comps
  12. autoload -Uz _rustup
  13. _comps[rustup]=_rustup
  14. unset ver ver_file comp_file
  15. fi