diff options
author | Alexander Blinne <alexander.blinne@uni-jena.de> | 2016-04-11 23:01:21 +0200 |
---|---|---|
committer | Alexander Blinne <alexander.blinne@uni-jena.de> | 2016-04-11 23:01:21 +0200 |
commit | 5f04b1fee4768b38e15952b87f39304b9612c5e6 (patch) | |
tree | c1d92fea88145fee8c14e9be2325bb24d21682b5 | |
parent | 9cba3ad5c9246b825470378d141e5a83acedfa85 (diff) | |
download | bash-git-prompt-0.3.tar.xz |
Effizienzsteigerungv0.3
-rw-r--r-- | bash-git-prompt | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/bash-git-prompt b/bash-git-prompt index 0eef652..e3159fc 100644 --- a/bash-git-prompt +++ b/bash-git-prompt @@ -4,22 +4,24 @@ set -o pipefail [[ "$TERM" = *-color ]] && mitFarbe=true || mitFarbe=false -[ -z "$PS1save" ] && PS1save="$PS1" +[ -z "$PS1Start" ] && [ -z "$PS1Ende" ] && + if echo "$PS1" | grep -q "\S" + then + PS1Ende="$(echo "$PS1" | sed "s|^.*[^\\]\(\\\\\?\S\s*\)\$|\1|")" + PS1Start="$(echo "$PS1" | sed "s|\\\\\?\S\s*\$||")" + else + PS1Ende="" + PS1Start="$PS1" + fi -if echo "$PS1save" | grep -q "\S" -then - PS1Ende="$(echo "$PS1save" | sed "s|^.*[^\\]\(\\\\\?\S\s*\)\$|\1|")" - PS1="$(echo "$PS1save" | sed "s|\\\\\?\S\s*\$||")" -else - PS1Ende="" - PS1="$PS1save" -fi +PS1="$PS1Start" if branch=$(git branch 2>/dev/null | grep '^\*' | sed "s|^\*\s*||") then PS1="$PS1 " - git status --porcelain | grep -q "^.\S" && wtClean=false || wtClean=true - git status --porcelain | grep -q "^\S" && idxClean=false || idxClean=true + status=$(git status --porcelain) + echo "$status" | grep -q "^.\S" && wtClean=false || wtClean=true + echo "$status" | grep -q "^\S" && idxClean=false || idxClean=true if $mitFarbe then if ! $wtClean |