1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2026-02-12 05:49:47 +08:00

Compare commits

..

3 Commits

Author SHA1 Message Date
Marco Franssen
9f77cb29d7 feat(sigstore): add completion plugin
Closes #10862

Signed-off-by: Marco Franssen <marco.franssen@gmail.com>
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
2022-11-08 19:44:45 +01:00
Sandeep Tailor
1f30c1a079
feat(hasura): add completion plugin (#11278) 2022-11-08 14:45:42 +01:00
Banst
6dfc9b960f
feat(git): display tag in git-prompt when possible (#11318)
Co-authored-by: Marc Cornellà <hello@mcornella.com>
2022-11-08 09:34:13 +01:00
5 changed files with 58 additions and 0 deletions

View File

@ -19,6 +19,7 @@ function git_prompt_info() {
local ref
ref=$(__git_prompt_git symbolic-ref --short HEAD 2> /dev/null) \
|| ref=$(__git_prompt_git describe --tags --exact-match HEAD 2> /dev/null) \
|| ref=$(__git_prompt_git rev-parse --short HEAD 2> /dev/null) \
|| return 0

9
plugins/hasura/README.md Normal file
View File

@ -0,0 +1,9 @@
# Hasura plugin
This plugin adds completion for [the Hasura CLI](https://hasura.io/docs/latest/hasura-cli/index/).
To use it, add `hasura` to the plugins array in your zshrc file:
```zsh
plugins=(... hasura)
```

View File

@ -0,0 +1,13 @@
if (( ! $+commands[hasura] )); then
return
fi
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_hasura" ]]; then
hasura completion zsh --file "$ZSH_CACHE_DIR/completions/_hasura" >/dev/null
source "$ZSH_CACHE_DIR/completions/_hasura"
else
source "$ZSH_CACHE_DIR/completions/_hasura"
hasura completion zsh --file "$ZSH_CACHE_DIR/completions/_hasura" >/dev/null &|
fi

View File

@ -0,0 +1,13 @@
# Sigstore plugin
This plugin sets up completion for the following [Sigstore](https://sigstore.dev/) CLI tools.
- [Cosign](https://docs.sigstore.dev/cosign/overview)
- [Sget](https://docs.sigstore.dev/cosign/installation#alpine-linux)
- [Rekor](https://docs.sigstore.dev/rekor/overview)
To use it, add `sigstore` to the plugins array in your zshrc file:
```zsh
plugins=(... sigstore)
```

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