diff options
author | Michael Allen <michael@michaelallen.io> | 2015-09-17 14:08:55 +0100 |
---|---|---|
committer | Michael Allen <michael@michaelallen.io> | 2015-09-17 14:08:55 +0100 |
commit | 1537438e5798502cad17ba10cf19016e400f7c42 (patch) | |
tree | 8811535f3d59421152407a37f78069f04d6ce8df | |
parent | 06e6a85ebd0d1090128079d0c7e31db43b591d27 (diff) | |
download | git-sonar-1537438e5798502cad17ba10cf19016e400f7c42.tar.gz git-sonar-1537438e5798502cad17ba10cf19016e400f7c42.zip |
Switch changes status to use prefixes
-rwxr-xr-x | radar-base.sh | 6 | ||||
-rwxr-xr-x | test-colors.sh | 4 | ||||
-rwxr-xr-x | test-format-config.sh | 18 |
3 files changed, 14 insertions, 14 deletions
diff --git a/radar-base.sh b/radar-base.sh index 47bcdf7..054acb7 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -31,7 +31,7 @@ prepare_bash_colors() { COLOR_BRANCH="\x01${GIT_RADAR_COLOR_BRANCH:-"\\033[0m"}\x02" MASTER_SYMBOL="${GIT_RADAR_MASTER_SYMBOL:-"\\x01\\033[0m\\x02\\xF0\\x9D\\x98\\xAE\\x01\\033[0m\\x02"}" - PROMPT_FORMAT="${GIT_RADAR_FORMAT:-" \\x01\\033[1;30m\\x02git:(\\x01\\033[0m\\x02%{remote: }%{branch}%{ :local}\\x01\\033[1;30m\\x02)\\x01\\033[0m\\x02%{changes}"}" + PROMPT_FORMAT="${GIT_RADAR_FORMAT:-" \\x01\\033[1;30m\\x02git:(\\x01\\033[0m\\x02%{remote: }%{branch}%{ :local}\\x01\\033[1;30m\\x02)\\x01\\033[0m\\x02%{ :changes}"}" RESET_COLOR_LOCAL="\x01${GIT_RADAR_COLOR_LOCAL_RESET:-"\\033[0m"}\x02" RESET_COLOR_REMOTE="\x01${GIT_RADAR_COLOR_REMOTE_RESET:-"\\033[0m"}\x02" @@ -67,7 +67,7 @@ prepare_zsh_colors() { COLOR_BRANCH="%{${GIT_RADAR_COLOR_BRANCH:-$reset_color}%}" MASTER_SYMBOL="${GIT_RADAR_MASTER_SYMBOL:-"%{$reset_color%}$italic_m%{$reset_color%}"}" - PROMPT_FORMAT="${GIT_RADAR_FORMAT:-" $fg_bold[grey]git:($reset_color%{remote: }%{branch}%{ :local}$fg_bold[grey])$reset_color%{changes}"}" + PROMPT_FORMAT="${GIT_RADAR_FORMAT:-" $fg_bold[grey]git:($reset_color%{remote: }%{branch}%{ :local}$fg_bold[grey])$reset_color%{ :changes}"}" RESET_COLOR_LOCAL="%{${GIT_RADAR_COLOR_LOCAL_RESET:-$reset_color}%}" RESET_COLOR_REMOTE="%{${GIT_RADAR_COLOR_REMOTE_RESET:-$reset_color}%}" @@ -394,7 +394,7 @@ color_changes_status() { changes="$staged_changes$conflicted_changes$unstaged_changes$untracked_changes" fi - printf $PRINT_F_OPTION "$changes" + printf $PRINT_F_OPTION "${changes:1}" } bash_color_changes_status() { diff --git a/test-colors.sh b/test-colors.sh index 69efc49..8cc072b 100755 --- a/test-colors.sh +++ b/test-colors.sh @@ -463,7 +463,7 @@ test_bash_colors_changes() { unstaged="1\x01changes-unstaged\x02M\x01change-reset\x02" staged="1\x01changes-staged\x02A\x01change-reset\x02" - printf -v expected " $staged $unstaged $untracked" + printf -v expected "$staged $unstaged $untracked" assertEquals "$expected" "$(bash_color_changes_status)" assertEquals "$expected" "$(color_changes_status)" rm_tmp @@ -485,7 +485,7 @@ test_zsh_colors_changes() { unstaged="1%{changes-unstaged%}M%{change-reset%}" staged="1%{changes-staged%}A%{change-reset%}" - assertEquals " $staged $unstaged $untracked" "$(zsh_color_changes_status)" + assertEquals "$staged $unstaged $untracked" "$(zsh_color_changes_status)" rm_tmp } diff --git a/test-format-config.sh b/test-format-config.sh index 7999560..ea76405 100755 --- a/test-format-config.sh +++ b/test-format-config.sh @@ -75,28 +75,28 @@ test_all_options_set_config() { unset_colours prompt="$(render_prompt)" - assertEquals "$prompt" "m 1 →foo1↑ 1A" + assertEquals "$prompt" "m 1 →foo1↑1A" export GIT_RADAR_FORMAT="%{remote}%{branch}%{changes}" prepare_zsh_colors unset_colours prompt="$(render_prompt)" - assertEquals "$prompt" "m 1 →foo 1A" + assertEquals "$prompt" "m 1 →foo1A" export GIT_RADAR_FORMAT="%{branch}%{local}%{changes}" prepare_zsh_colors unset_colours prompt="$(render_prompt)" - assertEquals "$prompt" "foo1↑ 1A" + assertEquals "$prompt" "foo1↑1A" export GIT_RADAR_FORMAT="%{branch}%{changes}" prepare_zsh_colors unset_colours prompt="$(render_prompt)" - assertEquals "$prompt" "foo 1A" + assertEquals "$prompt" "foo1A" export GIT_RADAR_FORMAT="%{branch}" prepare_zsh_colors @@ -116,21 +116,21 @@ test_reorder_parts() { unset_colours prompt="$(render_prompt)" - assertEquals "foo1↑ 1Am 1 →" "$prompt" + assertEquals "foo1↑1Am 1 →" "$prompt" export GIT_RADAR_FORMAT="%{local}%{changes}%{remote}%{branch}" prepare_zsh_colors unset_colours prompt="$(render_prompt)" - assertEquals "1↑ 1Am 1 →foo" "$prompt" + assertEquals "1↑1Am 1 →foo" "$prompt" export GIT_RADAR_FORMAT="%{changes}%{remote}%{branch}%{local}" prepare_zsh_colors unset_colours prompt="$(render_prompt)" - assertEquals " 1Am 1 →foo1↑" "$prompt" + assertEquals "1Am 1 →foo1↑" "$prompt" rm_tmp } @@ -143,14 +143,14 @@ test_prefix_and_suffix_changes() { unset_colours prompt="$(render_prompt)" - assertEquals " 1A" "$prompt" + assertEquals "1A" "$prompt" export GIT_RADAR_FORMAT="%{[:changes:]}" prepare_zsh_colors unset_colours prompt="$(render_prompt)" - assertEquals "[ 1A]" "$prompt" + assertEquals "[1A]" "$prompt" rm_tmp } |