aboutsummaryrefslogtreecommitdiffstats
path: root/src/_knife
diff options
context:
space:
mode:
authormidchildan <git@midchildan.org>2021-11-30 00:52:28 +0900
committermidchildan <git@midchildan.org>2021-11-30 00:52:28 +0900
commit1f5e5ff4715885b1e97f801fcf274e6868c7be59 (patch)
treec03da7c8d64df5027de3a1bb3d57c3278bbd7d9b /src/_knife
parentknife: improve code quality (diff)
downloadzsh-completions-1f5e5ff4715885b1e97f801fcf274e6868c7be59.tar
zsh-completions-1f5e5ff4715885b1e97f801fcf274e6868c7be59.tar.gz
zsh-completions-1f5e5ff4715885b1e97f801fcf274e6868c7be59.tar.bz2
zsh-completions-1f5e5ff4715885b1e97f801fcf274e6868c7be59.tar.lz
zsh-completions-1f5e5ff4715885b1e97f801fcf274e6868c7be59.tar.xz
zsh-completions-1f5e5ff4715885b1e97f801fcf274e6868c7be59.tar.zst
zsh-completions-1f5e5ff4715885b1e97f801fcf274e6868c7be59.zip
knife: improve completion for Chef Vault commands
Diffstat (limited to 'src/_knife')
-rw-r--r--src/_knife33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/_knife b/src/_knife
index 7a0c4a0..dc839ef 100644
--- a/src/_knife
+++ b/src/_knife
@@ -134,7 +134,7 @@ _knife() {
site)
compadd "$@" vendor show share search download list unshare
;;
- show|delete|edit)
+ show|delete|edit|update)
_arguments '3:Subsubcommands:($(_knife_list_remote "$words[2]"))'
;;
upload|test)
@@ -168,6 +168,16 @@ _knife() {
node|client|role)
compadd "$@" --attribute
;;
+ vault)
+ _arguments '4:Keys:($(_knife_list_remote "$words[2]" "$words[4]"))'
+ ;;
+ esac
+ ;;
+ update)
+ case "$words[2]" in
+ vault)
+ _arguments '4:Keys:($(_knife_list_remote "$words[2]" "$words[4]"))'
+ ;;
esac
;;
esac
@@ -249,18 +259,21 @@ _knife_options3() {
# get a list of objects of type x on the server
_knife_list_remote() {
case "$*" in
- role|client|node|cookbook|"cookbook site"|"data bag"|environment|user)
+ role|client|node|cookbook|"cookbook site"|"data bag"|environment|user|vault)
+ _call_program commands knife "$@" list --format json \
+ | grep \" \
+ | awk '{print $1}' \
+ | awk -F"," '{print $1}' \
+ | awk -F"\"" '{print $2}'
;;
- *)
- return
+ "vault "*)
+ _call_program commands knife vault show "$2" --format json \
+ | grep \" \
+ | awk '{print $1}' \
+ | awk -F"," '{print $1}' \
+ | awk -F"\"" '{print $2}'
;;
esac
-
- _call_program commands knife "$@" list --format json \
- | grep \" \
- | awk '{print $1}' \
- | awk -F"," '{print $1}' \
- | awk -F"\"" '{print $2}'
}
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server