diff options
Diffstat (limited to 'sonar-base.sh')
-rwxr-xr-x | sonar-base.sh | 83 |
1 files changed, 20 insertions, 63 deletions
diff --git a/sonar-base.sh b/sonar-base.sh index 95d943e..ed48726 100755 --- a/sonar-base.sh +++ b/sonar-base.sh @@ -28,82 +28,39 @@ get_fetch_time() { } -prepare_bash_colors() { - if [ -f "$rcfile_path/.gitradarrc.bash" ]; then - source "$rcfile_path/.gitradarrc.bash" - elif [ -f "$rcfile_path/.gitradarrc" ]; then +prepare_colors() { + if [ -f "$rcfile_path/.gitradarrc" ]; then source "$rcfile_path/.gitradarrc" fi PRINT_F_OPTION="" - COLOR_REMOTE_AHEAD="\x01${GIT_RADAR_COLOR_REMOTE_AHEAD:-"\\033[1;32m"}\x02" - COLOR_REMOTE_BEHIND="\x01${GIT_RADAR_COLOR_REMOTE_BEHIND:-"\\033[1;31m"}\x02" - COLOR_REMOTE_DIVERGED="\x01${GIT_RADAR_COLOR_REMOTE_DIVERGED:-"\\033[1;33m"}\x02" - COLOR_REMOTE_NOT_UPSTREAM="\x01${GIT_RADAR_COLOR_REMOTE_NOT_UPSTREAM:-"\\033[1;31m"}\x02" + COLOR_REMOTE_AHEAD="${GIT_RADAR_COLOR_REMOTE_AHEAD:-"\\033[1;32m"}" + COLOR_REMOTE_BEHIND="${GIT_RADAR_COLOR_REMOTE_BEHIND:-"\\033[1;31m"}" + COLOR_REMOTE_DIVERGED="${GIT_RADAR_COLOR_REMOTE_DIVERGED:-"\\033[1;33m"}" + COLOR_REMOTE_NOT_UPSTREAM="${GIT_RADAR_COLOR_REMOTE_NOT_UPSTREAM:-"\\033[1;31m"}" - COLOR_LOCAL_AHEAD="\x01${GIT_RADAR_COLOR_LOCAL_AHEAD:-"\\033[1;32m"}\x02" - COLOR_LOCAL_BEHIND="\x01${GIT_RADAR_COLOR_LOCAL_BEHIND:-"\\033[1;31m"}\x02" - COLOR_LOCAL_DIVERGED="\x01${GIT_RADAR_COLOR_LOCAL_DIVERGED:-"\\033[1;33m"}\x02" + COLOR_LOCAL_AHEAD="${GIT_RADAR_COLOR_LOCAL_AHEAD:-"\\033[1;32m"}" + COLOR_LOCAL_BEHIND="${GIT_RADAR_COLOR_LOCAL_BEHIND:-"\\033[1;31m"}" + COLOR_LOCAL_DIVERGED="${GIT_RADAR_COLOR_LOCAL_DIVERGED:-"\\033[1;33m"}" - COLOR_CHANGES_STAGED="\x01${GIT_RADAR_COLOR_CHANGES_STAGED:-"\\033[1;32m"}\x02" - COLOR_CHANGES_UNSTAGED="\x01${GIT_RADAR_COLOR_CHANGES_UNSTAGED:-"\\033[1;31m"}\x02" - 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_CHANGES_STAGED="${GIT_RADAR_COLOR_CHANGES_STAGED:-"\\033[1;32m"}" + COLOR_CHANGES_UNSTAGED="${GIT_RADAR_COLOR_CHANGES_UNSTAGED:-"\\033[1;31m"}" + COLOR_CHANGES_CONFLICTED="${GIT_RADAR_COLOR_CHANGES_CONFLICTED:-"\\033[1;33m"}" + COLOR_CHANGES_UNTRACKED="${GIT_RADAR_COLOR_CHANGES_UNTRACKED:-"\\033[1;37m"}" - COLOR_STASH="\x01${GIT_RADAR_COLOR_STASH:-"\\033[1;33m"}\x02" + COLOR_STASH="${GIT_RADAR_COLOR_STASH:-"\\033[1;33m"}" - COLOR_BRANCH="\x01${GIT_RADAR_COLOR_BRANCH:-"\\033[0m"}\x02" + COLOR_BRANCH="${GIT_RADAR_COLOR_BRANCH:-"\\033[0m"}" 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%{ :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" - 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() { - if [ -f "$rcfile_path/.gitradarrc.zsh" ]; then - source "$rcfile_path/.gitradarrc.zsh" - elif [ -f "$rcfile_path/.gitradarrc" ]; then - source "$rcfile_path/.gitradarrc" - fi - - PRINT_F_OPTION="%s" - - COLOR_REMOTE_AHEAD="%{${GIT_RADAR_COLOR_REMOTE_AHEAD:-${fg_bold[green]}}%}" - COLOR_REMOTE_BEHIND="%{${GIT_RADAR_COLOR_REMOTE_BEHIND:-${fg_bold[red]}}%}" - COLOR_REMOTE_DIVERGED="%{${GIT_RADAR_COLOR_REMOTE_DIVERGED:-${fg_bold[yellow]}}%}" - COLOR_REMOTE_NOT_UPSTREAM="%{${GIT_RADAR_COLOR_REMOTE_NOT_UPSTREAM:-${fg_bold[red]}}%}" - - COLOR_LOCAL_AHEAD="%{${GIT_RADAR_COLOR_LOCAL_AHEAD:-${fg_bold[green]}}%}" - COLOR_LOCAL_BEHIND="%{${GIT_RADAR_COLOR_LOCAL_BEHIND:-${fg_bold[red]}}%}" - COLOR_LOCAL_DIVERGED="%{${GIT_RADAR_COLOR_LOCAL_DIVERGED:-${fg_bold[yellow]}}%}" - - COLOR_CHANGES_STAGED="%{${GIT_RADAR_COLOR_CHANGES_STAGED:-${fg_bold[green]}}%}" - COLOR_CHANGES_UNSTAGED="%{${GIT_RADAR_COLOR_CHANGES_UNSTAGED:-${fg_bold[red]}}%}" - 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 - italic_m="$(printf '\xF0\x9D\x98\xAE')" - - 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%}%{ :stash}%{ :changes}"}" - - RESET_COLOR_LOCAL="%{${GIT_RADAR_COLOR_LOCAL_RESET:-$reset_color}%}" - 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}%}" + RESET_COLOR_LOCAL="${GIT_RADAR_COLOR_LOCAL_RESET:-"\\033[0m"}" + RESET_COLOR_REMOTE="${GIT_RADAR_COLOR_REMOTE_RESET:-"\\033[0m"}" + RESET_COLOR_CHANGES="${GIT_RADAR_COLOR_CHANGES_RESET:-"\\033[0m"}" + RESET_COLOR_BRANCH="${GIT_RADAR_COLOR_BRANCH_RESET:-"\\033[0m"}" + RESET_COLOR_STASH="${GIT_RADAR_COLOR_STASH:-"\\033[0m"}" } in_current_dir() { |