deno.plugin.zsh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # ALIASES
  2. alias db='deno bundle'
  3. alias dc='deno compile'
  4. alias dca='deno cache'
  5. alias dfmt='deno fmt'
  6. alias dh='deno help'
  7. alias dli='deno lint'
  8. alias drn='deno run'
  9. alias drA='deno run -A'
  10. alias drw='deno run --watch'
  11. alias dts='deno test'
  12. alias dup='deno upgrade'
  13. # COMPLETION FUNCTION
  14. if (( ! $+commands[deno] )); then
  15. return
  16. fi
  17. # TODO: 2021-12-28: remove this block
  18. # Handle $0 according to the standard:
  19. # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
  20. 0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
  21. 0="${${(M)0:#/*}:-$PWD/$0}"
  22. # Remove old generated files
  23. command rm -f "${0:A:h}/_deno" "$ZSH_CACHE_DIR/deno_version"
  24. # TODO: 2021-12-28: remove this bit of code as it exists in oh-my-zsh.sh
  25. # Add completions folder in $ZSH_CACHE_DIR
  26. command mkdir -p "$ZSH_CACHE_DIR/completions"
  27. (( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
  28. # If the completion file doesn't exist yet, we need to autoload it and
  29. # bind it to `deno`. Otherwise, compinit will have already done that.
  30. if [[ ! -f "$ZSH_CACHE_DIR/completions/_deno" ]]; then
  31. typeset -g -A _comps
  32. autoload -Uz _deno
  33. _comps[deno]=_deno
  34. fi
  35. deno completions zsh >| "$ZSH_CACHE_DIR/completions/_deno" &|