sigstore.plugin.zsh 571 B

1234567891011121314151617181920212223
  1. function install_autocompletion {
  2. if (( ! $+commands[$1] )); then
  3. return
  4. fi
  5. # If the completion file doesn't exist yet, we need to autoload it and
  6. # bind it to `$1` (cosign, sget, rekor-cli). Otherwise, compinit will
  7. # have already done that
  8. if [[ ! -f "$ZSH_CACHE_DIR/completions/_$1" ]]; then
  9. autoload -Uz _$1
  10. typeset -g -A _comps
  11. _comps[$1]=_$1
  12. fi
  13. $1 completion zsh >| "$ZSH_CACHE_DIR/completions/_$1" &|
  14. }
  15. install_autocompletion cosign
  16. install_autocompletion sget
  17. install_autocompletion rekor-cli
  18. unfunction install_autocompletion