Permalink
Browse files

show git status

  • Loading branch information...
1 parent 9568482 commit 866f1d68f97b8377882cbc34b8ee3d7582a8651d @carlosgaldino carlosgaldino committed Apr 3, 2011
Showing with 20 additions and 1 deletion.
  1. +20 −1 contrib/ps1_functions
View
21 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()
{

0 comments on commit 866f1d6

Please sign in to comment.