feat(procs): support completion for `procs<0.14` (#13053)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diff
1diff --git a/plugins/procs/procs.plugin.zsh b/plugins/procs/procs.plugin.zsh
2index 332985bf96ba8c6c64556d57da76284c5b944e51..8b15f1d5da65402643aa6a540cf551a04da358cb 100644
3--- a/plugins/procs/procs.plugin.zsh
4+++ b/plugins/procs/procs.plugin.zsh
5@@ -3,11 +3,19 @@ if (( ! $+commands[procs] )); then
6 fi
7 8 # If the completion file doesn't exist yet, we need to autoload it and
9-# bind it to `minikube`. Otherwise, compinit will have already done that.
10+# bind it to `procs`. Otherwise, compinit will have already done that.
11 if [[ ! -f "$ZSH_CACHE_DIR/completions/_procs" ]]; then
12 typeset -g -A _comps
13 autoload -Uz _procs
14 _comps[procs]=_procs
15 fi
1617-procs --gen-completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs" &|
18+{
19+ autoload -Uz is-at-least
20+ local _version=$(procs --version)
21+ if is-at-least "0.14" "${_version#procs }"; then
22+ procs --gen-completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
23+ else
24+ procs --completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
25+ fi
26+} &|