mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 20:29:45 +01:00
Merge pull request #1682 from maplebed/ben.knife
Allow you to customize the path to knife config files
This commit is contained in:
commit
1d66bef550
1 changed files with 12 additions and 5 deletions
|
@ -1,5 +1,10 @@
|
||||||
#compdef knife
|
#compdef knife
|
||||||
|
|
||||||
|
# You can override the path to knife.rb and your cookbooks by setting
|
||||||
|
# KNIFE_CONF_PATH=/path/to/my/.chef/knife.rb
|
||||||
|
# KNIFE_COOKBOOK_PATH=/path/to/my/chef/cookbooks
|
||||||
|
# Read around where these are used for more detail.
|
||||||
|
|
||||||
# These flags should be available everywhere according to man knife
|
# These flags should be available everywhere according to man knife
|
||||||
knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
|
knife_general_flags=( --help --server-url --key --config --editor --format --log_level --logfile --no-editor --user --print-after --version --yes )
|
||||||
|
|
||||||
|
@ -170,11 +175,13 @@ _chef_environments_remote() {
|
||||||
|
|
||||||
# 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
|
||||||
_chef_cookbooks_local() {
|
_chef_cookbooks_local() {
|
||||||
local knife_rb="$HOME/.chef/knife.rb"
|
|
||||||
|
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
|
||||||
if [ -f ./.chef/knife.rb ]; then
|
if [ -f ./.chef/knife.rb ]; then
|
||||||
knife_rb="./.chef/knife.rb"
|
knife_rb="./.chef/knife.rb"
|
||||||
fi
|
fi
|
||||||
(for i in $( grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done)
|
local cookbook_path=${KNIFE_COOKBOOK_PATH:-$(grep cookbook_path $knife_rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' )}
|
||||||
|
(for i in $cookbook_path; do ls $i; done)
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function extracts the available cookbook versions on the chef server
|
# This function extracts the available cookbook versions on the chef server
|
||||||
|
|
Loading…
Reference in a new issue