diff options
author | Michael Allen <michael@michaelallen.io> | 2015-10-16 13:49:34 +0100 |
---|---|---|
committer | Michael Allen <michael@michaelallen.io> | 2015-10-16 13:49:34 +0100 |
commit | 51b15bb282dd3c4fc789e2de913ffd561c5debcd (patch) | |
tree | e5e2d2676246e26d0014a0ccb29bbf2faa92272c | |
parent | 2091b01b75043fd37a3a33f1c9394f70f98ea8f7 (diff) | |
download | git-sonar-51b15bb282dd3c4fc789e2de913ffd561c5debcd.tar.gz git-sonar-51b15bb282dd3c4fc789e2de913ffd561c5debcd.zip |
Hook new stash_status in to render_prompt
-rwxr-xr-x | radar-base.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/radar-base.sh b/radar-base.sh index 26ea328..168acf6 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -509,7 +509,7 @@ stashed_status() { stash_status() { local number_stashes="$(stashed_status)" if [ $number_stashes -gt 0 ]; then - printf $PRINT_F_OPTION " $number_stashes$COLOR_STASH≡$RESET_COLOR_STASH" + printf $PRINT_F_OPTION "$number_stashes$COLOR_STASH≡$RESET_COLOR_STASH" fi } @@ -519,6 +519,7 @@ render_prompt() { remote_sed="" local_sed="" changes_sed="" + stash_sed="" if_pre="%\{([^%{}]{1,}:){0,1}" @@ -558,10 +559,19 @@ render_prompt() { changes_sed="s/${sed_pre}changes${sed_post}//" fi fi + if [[ $PROMPT_FORMAT =~ ${if_pre}stash${if_post} ]]; then + stash_result="$(stash_status)" + if [[ -n "$stash_result" ]]; then + stash_sed="s/${sed_pre}stash${sed_post}/\2${stash_result}\4/" + else + stash_sed="s/${sed_pre}stash${sed_post}//" + fi + fi printf '%b' "$output" | sed \ -e "$remote_sed" \ -e "$branch_sed" \ -e "$changes_sed" \ - -e "$local_sed" + -e "$local_sed" \ + -e "$stash_sed" } |