mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 05:29:30 +08:00
feat(sops): introduce sops plugin
This commit is contained in:
parent
7bbebcd520
commit
09b2eefef9
9
plugins/sops/README.md
Normal file
9
plugins/sops/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
## Sops
|
||||
|
||||
This plugin adds completion for [sops](https://github.com/scaleway/scaleway-cli), the simple and flexible tool for managing secrets.
|
||||
|
||||
To use it, add `sops` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... sops)
|
||||
```
|
23
plugins/sops/sops.plugin.zsh
Normal file
23
plugins/sops/sops.plugin.zsh
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Completion
|
||||
if (( ! $+commands[sops] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
_sops() {
|
||||
local -a opts
|
||||
local cur
|
||||
cur=${words[-1]}
|
||||
if [[ "$cur" == "-"* ]]; then
|
||||
opts=("${(@f)$(${words[@]:0:#words[@]-1} ${cur} --generate-shell-completion)}")
|
||||
else
|
||||
opts=("${(@f)$(${words[@]:0:#words[@]-1} --generate-shell-completion)}")
|
||||
fi
|
||||
|
||||
if [[ "${opts[1]}" != "" ]]; then
|
||||
_describe 'values' opts
|
||||
else
|
||||
_files
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _sops sops
|
Loading…
Reference in New Issue
Block a user