From e5e62e6044d921241ef47c6dd8f6b709e053a2b9 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Mon, 19 Nov 2018 21:30:40 +0100 Subject: [PATCH] Add counter for removed files to bash git prompt --- bashrc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index 3592b45..6cc7b7d 100644 --- a/bashrc +++ b/bashrc @@ -1,4 +1,3 @@ - alias hello='echo "Hello :)"' alias rmd='rm --recursive' alias temp='watch -t -d -n 1 sensors -A coretemp-isa-0000' @@ -40,6 +39,7 @@ git__prompt () { modif=`git status --short 2>/dev/null | grep -Po '^\s*M' | wc -l` untracked=`git status --short 2>/dev/null | grep -Po '^\?\?' | wc -l` added=`git status --short 2>/dev/null | grep -Po '^\s*A' | wc -l` + deleted=`git status --short 2>/dev/null | grep -Po '^\s*D' | wc -l` stat=`git branch -vv | grep -P '^\*' | grep -Po '\[.*\]'` ahead=`echo $stat | grep -Po '(?<=ahead )\d*'` behind=`echo $stat | grep -Po '(?<=behind )\d*'` @@ -70,6 +70,10 @@ git__prompt () { then echo -ne "${green}+$added" fi + if [ $deleted -ne 0 ] + then + echo -ne "${red}-$deleted" + fi if [ $untracked -ne 0 ] then echo -ne "${red}*"