fnm.plugin.zsh 511 B

1234567891011121314151617181920
  1. if (( $+commands[fnm] )); then
  2. ver="$(fnm --version)"
  3. ver_file="$ZSH_CACHE_DIR/fnm_version"
  4. comp_file="$ZSH_CACHE_DIR/completions/_fnm"
  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. fnm completions --shell=zsh >| "$comp_file"
  9. echo "$ver" >| "$ver_file"
  10. fi
  11. declare -A _comps
  12. autoload -Uz _fnm
  13. _comps[fnm]=_fnm
  14. unset ver ver_file comp_file
  15. fi