From bff1f0488e7b3cb1f4b89c698dbc282bd9a5c0aa Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Thu, 6 Aug 2015 10:03:34 +0100 Subject: Preserve whitespace in function results --- git-base.sh | 8 ++++---- prompt.sh | 20 +------------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/git-base.sh b/git-base.sh index afd4f7e..11a88c5 100755 --- a/git-base.sh +++ b/git-base.sh @@ -331,7 +331,7 @@ bash_color_changes_status() { changes="$staged_changes$conflicted_changes$unstaged_changes$untracked_changes" fi - echo $changes + echo "$changes" } zsh_color_changes_status() { @@ -367,7 +367,7 @@ zsh_color_changes_status() { changes="$staged_changes$conflicted_changes$unstaged_changes$untracked_changes" fi - echo $changes + echo "$changes" } bash_color_local_commits() { @@ -393,7 +393,7 @@ bash_color_local_commits() { fi fi fi - echo $local_commits + echo "$local_commits" } zsh_color_local_commits() { @@ -419,5 +419,5 @@ zsh_color_local_commits() { fi fi fi - echo $local_commits + echo "$local_commits" } diff --git a/prompt.sh b/prompt.sh index 056a74f..a1ffbbd 100755 --- a/prompt.sh +++ b/prompt.sh @@ -1,23 +1,5 @@ source ./git-base.sh -local_ahead="$(commits_ahead_of_remote)" -ahead_arrow="↑" - -if [[ ("$local_ahead" -gt 0) ]]; then - local_ahead=" ${local_ahead}${ahead_arrow}" -else - local_ahead="" -fi - -local_behind="$(commits_behind_of_remote)" -behind_arrow="↓" - -if [[ "$local_behind" -gt "0" ]]; then - local_behind=" ${local_behind}${behind_arrow}" -else - local_behind="" -fi - -prompt="$(branch_name) $(bash_color_local_commits) $(bash_color_changes_status)" +prompt="$(branch_name)$(bash_color_local_commits)$(bash_color_changes_status)" echo $prompt -- cgit v1.2.3