2021-04-26 01:14:05 +08:00
|
|
|
# ALIASES
|
|
|
|
alias db='deno bundle'
|
|
|
|
alias dc='deno compile'
|
|
|
|
alias dca='deno cache'
|
|
|
|
alias dfmt='deno fmt'
|
|
|
|
alias dh='deno help'
|
|
|
|
alias dli='deno lint'
|
|
|
|
alias drn='deno run'
|
2021-12-18 07:40:57 +08:00
|
|
|
alias drA='deno run -A'
|
2021-04-26 01:14:05 +08:00
|
|
|
alias drw='deno run --watch'
|
|
|
|
alias dts='deno test'
|
|
|
|
alias dup='deno upgrade'
|
|
|
|
|
|
|
|
# COMPLETION FUNCTION
|
|
|
|
if (( $+commands[deno] )); then
|
2021-12-19 04:53:49 +08:00
|
|
|
# Handle $0 according to the standard:
|
|
|
|
# # https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
|
|
|
|
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
|
|
|
|
0="${${(M)0:#/*}:-$PWD/$0}"
|
|
|
|
|
2021-09-16 00:47:51 +08:00
|
|
|
# remove old generated completion file
|
|
|
|
command rm -f "${0:A:h}/_deno"
|
|
|
|
|
2021-09-16 00:18:25 +08:00
|
|
|
ver="$(deno --version)"
|
|
|
|
ver_file="$ZSH_CACHE_DIR/deno_version"
|
2021-09-16 00:41:44 +08:00
|
|
|
comp_file="$ZSH_CACHE_DIR/completions/_deno"
|
|
|
|
|
|
|
|
mkdir -p "${comp_file:h}"
|
|
|
|
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
|
2021-09-16 00:18:25 +08:00
|
|
|
|
|
|
|
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
|
|
|
|
deno completions zsh >| "$comp_file"
|
|
|
|
echo "$ver" >| "$ver_file"
|
2021-04-26 01:14:05 +08:00
|
|
|
fi
|
2021-09-16 00:18:25 +08:00
|
|
|
|
|
|
|
declare -A _comps
|
2021-04-26 17:54:53 +08:00
|
|
|
autoload -Uz _deno
|
|
|
|
_comps[deno]=_deno
|
2021-09-16 00:18:25 +08:00
|
|
|
|
|
|
|
unset ver ver_file comp_file
|
2021-04-26 01:14:05 +08:00
|
|
|
fi
|