Skip to content

Commit

Permalink
show git status
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosgaldino committed Apr 3, 2011
1 parent 9568482 commit 866f1d6
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion contrib/ps1_functions
Expand Up @@ -70,10 +70,29 @@ ps1_git()
esac esac


if [[ $color -gt 0 ]] ; then 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 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() ps1_rvm()
{ {
Expand Down

0 comments on commit 866f1d6

Please sign in to comment.