abra zsh config 2.0

This commit is contained in:
Andrey Anurin
2018-08-12 15:26:21 +03:00
parent 201abd09c4
commit 6b114440e2
1195 changed files with 68948 additions and 10539 deletions

View File

@@ -1,5 +1,26 @@
#compdef knife
# ------------------------------------------------------------------------------
# Copyright (c) 2009-2015 Robby Russell and contributors (see
# https://github.com/robbyrussell/oh-my-zsh/contributors)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
@@ -44,7 +65,7 @@ _knife() {
case $state in
knifecmd)
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" environment user exec index node recipe role search ssh status windows $cloudproviders
compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" diff environment user exec index node recipe role search ssh status windows $cloudproviders
;;
knifesubcmd)
case $words[2] in
@@ -60,6 +81,9 @@ _knife() {
cookbook)
compadd -Q "$@" test list create download delete "metadata from" show "bulk delete" metadata upload
;;
diff)
_arguments '*:file or directory:_files -g "*.(rb|json)"'
;;
environment)
compadd -Q "$@" create delete edit "from file" list show
;;
@@ -195,7 +219,7 @@ _chef_users_remote() {
# The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server
_chef_cookbooks_local() {
(for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
(for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' | cut -d '"' -f2 ); do ls $i; done)
}
# This function extracts the available cookbook versions on the chef server