procs.plugin.zsh
595 bytes
1if (( ! $+commands[procs] )); then
2 return
3fi
4
5# If the completion file doesn't exist yet, we need to autoload it and
6# bind it to `procs`. Otherwise, compinit will have already done that.
7if [[ ! -f "$ZSH_CACHE_DIR/completions/_procs" ]]; then
8 typeset -g -A _comps
9 autoload -Uz _procs
10 _comps[procs]=_procs
11fi
12
13{
14 autoload -Uz is-at-least
15 local _version=$(procs --version)
16 if is-at-least "0.14" "${_version#procs }"; then
17 procs --gen-completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
18 else
19 procs --completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
20 fi
21} &|