Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'git_status' of https://github.com/carlosgaldino/rvm int…

…o carlosgaldino-git_status
  • Loading branch information...
commit 682739b1cebea7de4a52177dda326dea79f6fa26 2 parents 89e301c + 866f1d6
@wayneeseguin wayneeseguin authored
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()
{
Please sign in to comment.
Something went wrong with that request. Please try again.