Small fixes for bash prompt.

This commit is contained in:
Ivan Malison 2014-04-08 11:22:09 -07:00
parent ea3962b380
commit 312e8266c9

View File

@ -1,3 +1,18 @@
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
function current_directory() {
local PWD=$(pwd)
echo "${PWD/#$HOME/~}"
}
function current_directory() { function current_directory() {
local PWD=$(pwd) local PWD=$(pwd)
echo "${PWD/#$HOME/~}" echo "${PWD/#$HOME/~}"
@ -8,8 +23,25 @@ function git_prompt_info () {
then then
echo "" echo ""
else else
echo "on $(parse_git_branch)" echo " on $(parse_git_branch)$(git_status_character)"
fi fi
} }
PS1='%u at $(hostname -s) in $(current_directory) $(git_prompt_info) $(colored_sandbox_string) ' function git_status_character() {
if git_is_dirty;
then
echo "✘"
else
echo "✔"
fi
}
function sandbox_prompt() {
if [ ! -z $(sandbox_prompt_info) ];
then
echo " with $(colored_sandbox_string)"
fi
}
PS1="╭─% ${Green}\u ${White}at ${Blue}\h ${White}in \$(current_directory)\$(git_prompt_info)\$(sandbox_prompt)
╰─± "