Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion git-radar
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions prompt_fish.bash
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions radar-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down