Created
February 14, 2014 15:16
-
-
Save maewolfsky/9002802 to your computer and use it in GitHub Desktop.
Really basic way to display the currently "active" chef-server in your bash prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parse_chef_server | |
{ | |
if [ -r .chef/knife.rb ]; then | |
knife_config='.chef/knife.rb' | |
elif [ -r ../.chef/knife.rb ]; then | |
knife_config='../.chef/knife.rb' | |
fi | |
## Make sure that the knife_config was actually set before running the grep | |
[[ $knife_config ]] && grep chef_server_url $knife_config | awk -F/ '{print "[chef:" $3 "]"}' | |
} | |
PS1="\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \[\033[00m\] \n\$(parse_git_branch)\$(parse_chef_server)$ " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment