diff --git a/contrib/ps1_functions b/contrib/ps1_functions index 514db0c55e..9f7f31705d 100644 --- a/contrib/ps1_functions +++ b/contrib/ps1_functions @@ -70,10 +70,29 @@ ps1_git() esac if [[ $color -gt 0 ]] ; then - printf "\[\033[${attr}${color}m\](git:${branch}:$sha1)\[\033[0m\] " + printf "\[\033[${attr}${color}m\](git:${branch}$(parse_git_status):$sha1)\[\033[0m\] " fi } +parse_git_status() +{ + printf "$(parse_git_added)$(parse_git_modified)$(parse_git_deleted)" +} + +parse_git_deleted() +{ + [[ $(git status 2> /dev/null | grep deleted:) != "" ]] && echo "-" +} + +parse_git_added() +{ + [[ $(git status 2> /dev/null | grep "Untracked files:") != "" ]] && echo '+' +} + +parse_git_modified() +{ + [[ $(git status 2> /dev/null | grep modified:) != "" ]] && echo "*" +} ps1_rvm() {