summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Blinne <alexander.blinne@uni-jena.de>2016-04-11 21:08:06 +0200
committerAlexander Blinne <alexander.blinne@uni-jena.de>2016-04-11 21:08:06 +0200
commitca1e617eddb6225166b0e626e187a14c7cbd2ae0 (patch)
tree61894c1984de689f8036a10f807ebca57a6503bb
parent5e535df7f98a7f74adc2af6c23c37092725914c4 (diff)
downloadbash-git-prompt-0.0.tar.xz
soweit vllt. fertigv0.0
-rw-r--r--bash-git-prompt15
1 files changed, 12 insertions, 3 deletions
diff --git a/bash-git-prompt b/bash-git-prompt
index 9bce386..4a510ba 100644
--- a/bash-git-prompt
+++ b/bash-git-prompt
@@ -1,12 +1,21 @@
#!/bin/bash
-PS='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}<\t> \[\033[01;32m\]\u\[\033[00m\]@\[\033[01;33m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]'
+PS1='\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}<\t> \[\033[01;32m\]\u\[\033[00m\]@\[\033[01;33m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]'
set -o pipefail
if branch=$(git branch 2>/dev/null | grep '\*' | cut -d' ' -f2)
then
- PS1="$PS $branch\$ "
+ if git status --porcelain | grep -q "^.\S"
+ then
+ PS1="$PS1 \[\033[01;31m\]"
+ elif git status --porcelain | grep -q "^\S"
+ then
+ PS1="$PS1 \[\033[01;33m\]"
+ else
+ PS1="$PS1 \[\033[01;32m\]"
+ fi
+ PS1="$PS1$branch\[\033[00m\]\$ "
else
- PS1="$PS\$ "
+ PS1="$PS1\$ "
fi