knife: improve completion for Chef Vault commands
This commit is contained in:
parent
392487b0fa
commit
1f5e5ff471
33
src/_knife
33
src/_knife
|
@ -134,7 +134,7 @@ _knife() {
|
||||||
site)
|
site)
|
||||||
compadd "$@" vendor show share search download list unshare
|
compadd "$@" vendor show share search download list unshare
|
||||||
;;
|
;;
|
||||||
show|delete|edit)
|
show|delete|edit|update)
|
||||||
_arguments '3:Subsubcommands:($(_knife_list_remote "$words[2]"))'
|
_arguments '3:Subsubcommands:($(_knife_list_remote "$words[2]"))'
|
||||||
;;
|
;;
|
||||||
upload|test)
|
upload|test)
|
||||||
|
@ -168,6 +168,16 @@ _knife() {
|
||||||
node|client|role)
|
node|client|role)
|
||||||
compadd "$@" --attribute
|
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
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -249,18 +259,21 @@ _knife_options3() {
|
||||||
# get a list of objects of type x on the server
|
# get a list of objects of type x on the server
|
||||||
_knife_list_remote() {
|
_knife_list_remote() {
|
||||||
case "$*" in
|
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}'
|
||||||
;;
|
;;
|
||||||
*)
|
"vault "*)
|
||||||
return
|
_call_program commands knife vault show "$2" --format json \
|
||||||
|
| grep \" \
|
||||||
|
| awk '{print $1}' \
|
||||||
|
| awk -F"," '{print $1}' \
|
||||||
|
| awk -F"\"" '{print $2}'
|
||||||
;;
|
;;
|
||||||
esac
|
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
|
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
|
||||||
|
|
Loading…
Reference in New Issue