diff --git a/dotfiles/lib/bash/prompt.sh b/dotfiles/lib/bash/prompt.sh index 2a71138f..f075a5b0 100644 --- a/dotfiles/lib/bash/prompt.sh +++ b/dotfiles/lib/bash/prompt.sh @@ -1,15 +1,47 @@ +# 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 git_prompt_info () { +function current_directory() { + local PWD=$(pwd) + echo "${PWD/#$HOME/~}" +} + +function git_prompt_info() { if test -z $(parse_git_branch); then echo "" else - echo "on $(parse_git_branch)" + echo " on $(parse_git_branch)$(git_status_character)" 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) +╰─± "