1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-07 16:00:41 +01:00

feat(sigstore): add completion plugin

Closes #10862

Signed-off-by: Marco Franssen <marco.franssen@gmail.com>
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
Marco Franssen
2022-04-15 20:43:43 +02:00
committed by Carlo Sala
parent 1f30c1a079
commit 9f77cb29d7
2 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
function install_autocompletion {
if (( ! $+commands[$1] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `$1` (cosign, sget, rekor-cli). Otherwise, compinit will
# have already done that
if [[ ! -f "$ZSH_CACHE_DIR/completions/_$1" ]]; then
autoload -Uz _$1
typeset -g -A _comps
_comps[$1]=_$1
fi
$1 completion zsh >| "$ZSH_CACHE_DIR/completions/_$1" &|
}
install_autocompletion cosign
install_autocompletion sget
install_autocompletion rekor-cli
unfunction install_autocompletion