mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
Added option to allow for relative path resolution for cookbooks
This commit is contained in:
parent
6475bc1677
commit
412e0814f5
1 changed files with 11 additions and 5 deletions
|
|
@ -3,6 +3,9 @@
|
|||
# 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
|
||||
# If you want your local cookbooks path to be calculated relative to where you are then
|
||||
# set the below option
|
||||
# KNIFE_RELATIVE_PATH=true
|
||||
# Read around where these are used for more detail.
|
||||
|
||||
# These flags should be available everywhere according to man knife
|
||||
|
|
@ -207,12 +210,15 @@ _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
|
||||
_chef_cookbooks_local() {
|
||||
|
||||
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
|
||||
if [ -f ./.chef/knife.rb ]; then
|
||||
knife_rb="./.chef/knife.rb"
|
||||
if [ $KNIFE_RELATIVE_PATH ]; then
|
||||
local cookbook_path="$(_chef_root)/cookbooks"
|
||||
else
|
||||
local knife_rb=${KNIFE_CONF_PATH:-${HOME}/.chef/knife.rb}
|
||||
if [ -f ./.chef/knife.rb ]; then
|
||||
knife_rb="./.chef/knife.rb"
|
||||
fi
|
||||
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/' )}
|
||||
fi
|
||||
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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue