diff --git a/git-radar b/git-radar index f736e41..7e8e188 100755 --- a/git-radar +++ b/git-radar @@ -100,7 +100,11 @@ while [[ $# > 0 ]];do $dot/prompt.zsh $args fi - if [[ "$command" == "--bash" || "$command" == "--fish" ]]; then + if [[ "$command" == "--bash" ]]; then $dot/prompt.bash $args fi + + if [[ "$command" == "--fish" ]]; then + $dot/prompt_fish.bash $args + fi done diff --git a/prompt_fish.bash b/prompt_fish.bash new file mode 100755 index 0000000..80781c0 --- /dev/null +++ b/prompt_fish.bash @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +dot="$(cd "$(dirname "$0")"; pwd)" +args=$@ +source "$dot/radar-base.sh" + +if is_repo; then + prepare_fish_colors + render_prompt +fi diff --git a/radar-base.sh b/radar-base.sh index 61503fd..1f8c282 100755 --- a/radar-base.sh +++ b/radar-base.sh @@ -105,6 +105,44 @@ prepare_zsh_colors() { RESET_COLOR_STASH="%{${GIT_RADAR_COLOR_STASH:-$reset_color}%}" } +prepare_fish_colors() { + if [ -f "$rcfile_path/.gitradarrc.bash" ]; then + source "$rcfile_path/.gitradarrc.bash" + elif [ -f "$rcfile_path/.gitradarrc" ]; then + source "$rcfile_path/.gitradarrc" + fi + + PRINT_F_OPTION="" + + 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="${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="${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="${GIT_RADAR_COLOR_STASH:-"\\033[1;33m"}" + + COLOR_BRANCH="${GIT_RADAR_COLOR_BRANCH:-"\\033[0m"}" + MASTER_SYMBOL="${GIT_RADAR_MASTER_SYMBOL:-"𝘮\\033[0m\\033[0m"}" + + PROMPT_FORMAT="${GIT_RADAR_FORMAT:-" \\033[1;30mgit:(\\033[0m%{remote: }%{branch}%{ :local}\\033[1;30m)\\033[0m%{ :stash}%{ :changes}"}" + + 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() { local wd="$(pwd)" if [[ "$wd" == $cwd ]]; then