From 989911c595b19aac9ecb4aa87eb2ac4d57610c86 Mon Sep 17 00:00:00 2001 From: Claudio Bandera Date: Fri, 28 Aug 2015 10:35:47 +0200 Subject: Added git stash indicator --- radar-base.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'radar-base.sh') diff --git a/radar-base.sh b/radar-base.sh index b7074d8..aa8ed2f 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -469,3 +469,17 @@ zsh_color_remote_commits() { printf %s "$remote" } + +bash_stash_status() { + local number_stashes="$(git stash list | wc -l)" + if [ $number_stashes -gt 0 ]; then + printf " $number_stashes\x01\033[1;33m\x02␣\x01\033[0m\x02)" + fi +} + +zsh_stash_status() { + local number_stashes="$(git stash list | wc -l)" + if [ $number_stashes -gt 0 ]; then + printf %s " $number_stashes%{$fg_bold[yellow]%}␣%{$reset_color%})" + fi +} \ No newline at end of file -- cgit v1.2.3 From 2cfe557beb7fec2e67ea8cd0096eeff0be14b00f Mon Sep 17 00:00:00 2001 From: Claudio Bandera Date: Fri, 28 Aug 2015 10:54:17 +0200 Subject: Changed symbol for stash --- radar-base.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'radar-base.sh') diff --git a/radar-base.sh b/radar-base.sh index aa8ed2f..1be76e4 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -473,13 +473,13 @@ zsh_color_remote_commits() { bash_stash_status() { local number_stashes="$(git stash list | wc -l)" if [ $number_stashes -gt 0 ]; then - printf " $number_stashes\x01\033[1;33m\x02␣\x01\033[0m\x02)" + printf " $number_stashes\x01\033[1;33m\x02=\x01\033[0m\x02)" fi } zsh_stash_status() { local number_stashes="$(git stash list | wc -l)" if [ $number_stashes -gt 0 ]; then - printf %s " $number_stashes%{$fg_bold[yellow]%}␣%{$reset_color%})" + printf %s " $number_stashes%{$fg_bold[yellow]%}=%{$reset_color%})" fi } \ No newline at end of file -- cgit v1.2.3 From 4a7d636bad0d03af22f440bef9bd141bfc0dc309 Mon Sep 17 00:00:00 2001 From: Claudio Bandera Date: Mon, 31 Aug 2015 00:07:46 +0200 Subject: Added tests for stash indicator --- radar-base.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'radar-base.sh') diff --git a/radar-base.sh b/radar-base.sh index 1be76e4..ec907b0 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -470,16 +470,20 @@ zsh_color_remote_commits() { printf %s "$remote" } +stashed_status() { + printf '%s' "$(git stash list | wc -l 2>/dev/null)" +} + bash_stash_status() { - local number_stashes="$(git stash list | wc -l)" + local number_stashes="$(stashed_status)" if [ $number_stashes -gt 0 ]; then - printf " $number_stashes\x01\033[1;33m\x02=\x01\033[0m\x02)" + printf " $number_stashes\x01\033[1;33m\x02=\x01\033[0m\x02" fi } zsh_stash_status() { - local number_stashes="$(git stash list | wc -l)" + local number_stashes="$(stashed_status)" if [ $number_stashes -gt 0 ]; then - printf %s " $number_stashes%{$fg_bold[yellow]%}=%{$reset_color%})" + printf %s " $number_stashes%{$fg_bold[yellow]%}=%{$reset_color%}" fi } \ No newline at end of file -- cgit v1.2.3 From 5adc604fc1b0c11af8a85928e2a7d756fc5ad776 Mon Sep 17 00:00:00 2001 From: Claudio Bandera Date: Thu, 17 Sep 2015 18:27:25 +0200 Subject: Adapted new color and naming model. --- radar-base.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'radar-base.sh') diff --git a/radar-base.sh b/radar-base.sh index 58a28c1..b8ab1f2 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -28,6 +28,8 @@ prepare_bash_colors() { COLOR_CHANGES_CONFLICTED="\x01${GIT_RADAR_COLOR_CHANGES_CONFLICTED:-"\\033[1;33m"}\x02" COLOR_CHANGES_UNTRACKED="\x01${GIT_RADAR_COLOR_CHANGES_UNTRACKED:-"\\033[1;37m"}\x02" + COLOR_STASH="\x01${GIT_RADAR_COLOR_STASH:-"\\033[1;33m"}\x02" + 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"}" @@ -35,6 +37,8 @@ prepare_bash_colors() { RESET_COLOR_REMOTE="\x01${GIT_RADAR_COLOR_REMOTE_RESET:-"\\033[0m"}\x02" RESET_COLOR_CHANGES="\x01${GIT_RADAR_COLOR_CHANGES_RESET:-"\\033[0m"}\x02" RESET_COLOR_BRANCH="\x01${GIT_RADAR_COLOR_BRANCH_RESET:-"\\033[0m"}\x02" + RESET_COLOR_STASH="\x01${GIT_RADAR_COLOR_STASH:-"\\033[0m"}\x02" + } prepare_zsh_colors() { @@ -60,6 +64,8 @@ prepare_zsh_colors() { COLOR_CHANGES_CONFLICTED="%{${GIT_RADAR_COLOR_CHANGES_CONFLICTED:-$fg_bold[yellow]}%}" COLOR_CHANGES_UNTRACKED="%{${GIT_RADAR_COLOR_CHANGES_UNTRACKED:-$fg_bold[white]}%}" + COLOR_STASH="%{${GIT_RADAR_COLOR_STASH:-$fg_bold[yellow]}%}" + local italic_m="$(printf '\xF0\x9D\x98\xAE')" COLOR_BRANCH="%{${GIT_RADAR_COLOR_BRANCH:-$reset_color}%}" @@ -69,6 +75,7 @@ prepare_zsh_colors() { RESET_COLOR_REMOTE="%{${GIT_RADAR_COLOR_REMOTE_RESET:-$reset_color}%}" RESET_COLOR_CHANGES="%{${GIT_RADAR_COLOR_CHANGES_RESET:-$reset_color}%}" RESET_COLOR_BRANCH="%{${GIT_RADAR_COLOR_BRANCH_RESET:-$reset_color}%}" + RESET_COLOR_STASH="%{${GIT_RADAR_COLOR_STASH:-$reset_color}%}" } in_current_dir() { @@ -489,16 +496,9 @@ stashed_status() { printf '%s' "$(git stash list | wc -l 2>/dev/null)" } -bash_stash_status() { - local number_stashes="$(stashed_status)" - if [ $number_stashes -gt 0 ]; then - printf " $number_stashes\x01\033[1;33m\x02=\x01\033[0m\x02" - fi -} - -zsh_stash_status() { +stash_status() { local number_stashes="$(stashed_status)" if [ $number_stashes -gt 0 ]; then - printf %s " $number_stashes%{$fg_bold[yellow]%}=%{$reset_color%}" + printf $PRINT_F_OPTION " $number_stashes$COLOR_STASH≡$RESET_COLOR_STASH" fi } -- cgit v1.2.3 From 51b15bb282dd3c4fc789e2de913ffd561c5debcd Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Fri, 16 Oct 2015 13:49:34 +0100 Subject: Hook new stash_status in to render_prompt --- radar-base.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'radar-base.sh') 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" } -- cgit v1.2.3 From 6b3360f2a00b55043d2dba574223c6ba77e76580 Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Fri, 16 Oct 2015 13:51:15 +0100 Subject: Include stash indicator in default prompt --- radar-base.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'radar-base.sh') diff --git a/radar-base.sh b/radar-base.sh index 168acf6..f3b0d49 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -41,7 +41,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%{ :stash}%{ :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" @@ -81,7 +81,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%}%{ :stash}%{ :changes}"}" RESET_COLOR_LOCAL="%{${GIT_RADAR_COLOR_LOCAL_RESET:-$reset_color}%}" RESET_COLOR_REMOTE="%{${GIT_RADAR_COLOR_REMOTE_RESET:-$reset_color}%}" -- cgit v1.2.3 From 5f5ea03dc57b8aca2a8f8ac938d044dcd110d57a Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Fri, 16 Oct 2015 13:52:54 +0100 Subject: Strip spaces from the stash number (which OSX wc adds for no reason) --- radar-base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'radar-base.sh') diff --git a/radar-base.sh b/radar-base.sh index f3b0d49..c355f3c 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -503,7 +503,7 @@ show_remote_status() { } stashed_status() { - printf '%s' "$(git stash list | wc -l 2>/dev/null)" + printf '%s' "$(git stash list | wc -l 2>/dev/null | grep -oEi '[0-9][0-9]*')" } stash_status() { -- cgit v1.2.3