summaryrefslogtreecommitdiffstats
path: root/radar-base.sh
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-09-15 10:04:15 +0100
committerMichael Allen <michael@michaelallen.io>2015-09-16 15:37:05 +0100
commit5c68ecdd5d388a4a5604c0f377c4b917eb0dcfff (patch)
tree417543323650f283428ff2f926fc73a906127ee6 /radar-base.sh
parent8c682d2abddd006398e9aed0a61212b4648b5a59 (diff)
downloadgit-sonar-5c68ecdd5d388a4a5604c0f377c4b917eb0dcfff.tar.gz
git-sonar-5c68ecdd5d388a4a5604c0f377c4b917eb0dcfff.zip
Make render replace rather than append, so we can reorder
Diffstat (limited to 'radar-base.sh')
-rwxr-xr-xradar-base.sh21
1 files changed, 16 insertions, 5 deletions
diff --git a/radar-base.sh b/radar-base.sh
index e21122a..066da99 100755
--- a/radar-base.sh
+++ b/radar-base.sh
@@ -488,16 +488,27 @@ show_remote_status() {
}
render_prompt() {
- if [[ $PROMPT_FORMAT =~ ^.*%{remote}.*$ ]]; then
- zsh_color_remote_commits
+ output="$PROMPT_FORMAT"
+ branch_sed=""
+ remote_sed=""
+ local_sed=""
+ changes_sed=""
+ if [[ $output =~ ^.*%{remote}.*$ ]]; then
+ remote_sed="s/%{remote}/$(zsh_color_remote_commits)/"
fi
if [[ $PROMPT_FORMAT =~ ^.*%{branch}.*$ ]]; then
- zsh_readable_branch_name
+ branch_sed="s/%{branch}/$(zsh_readable_branch_name)/"
fi
if [[ $PROMPT_FORMAT =~ ^.*%{local}.*$ ]]; then
- zsh_color_local_commits
+ local_sed="s/%{local}/$(zsh_color_local_commits)/"
fi
if [[ $PROMPT_FORMAT =~ ^.*%{changes}.*$ ]]; then
- zsh_color_changes_status
+ changes_sed="s/%{changes}/$(zsh_color_changes_status)/"
fi
+
+ sed \
+ -e "$remote_sed" \
+ -e "$branch_sed" \
+ -e "$changes_sed" \
+ -e "$local_sed" <<<"$output"
}