diff options
Diffstat (limited to '')
| -rwxr-xr-x | git-base.sh | 36 | ||||
| -rwxr-xr-x | prompt.sh | 2 | 
2 files changed, 37 insertions, 1 deletions
| diff --git a/git-base.sh b/git-base.sh index 1b5ce30..e60f9fc 100755 --- a/git-base.sh +++ b/git-base.sh @@ -298,6 +298,42 @@ untracked_status() {    echo "$untracked_string"  } +bash_color_changes_status() { +  local porcelain="$(porcelain_status)" +  local changes="" + +  if [[ -n "$porcelain" ]]; then +    local green_staged_prefix="\033[1;32m" +    local red_unstaged_prefix="\033[1;31m" +    local yellow_conflicted_prefix="\033[1;33m" +    local grey_untracked_prefix="\033[1;37m" +    local reset_suffix="\033[0m" + +    local staged_changes="$(staged_status "$porcelain" "$green_staged_prefix" "$reset_suffix")" +    local unstaged_changes="$(unstaged_status "$porcelain" "$red_unstaged_prefix" "$reset_suffix")" +    local untracked_changes="$(untracked_status "$porcelain" "$grey_untracked_prefix" "$reset_suffix")" +    local conflicted_changes="$(conflicted_status "$porcelain" "$yellow_conflicted_prefix" "$reset_suffix")" +    if [[ -n "$staged_changes" ]]; then +      staged_changes=" $staged_changes" +    fi + +    if [[ -n "$unstaged_changes" ]]; then +      unstaged_changes=" $unstaged_changes" +    fi + +    if [[ -n "$conflicted_changes" ]]; then +      conflicted_changes=" $conflicted_changes" +    fi + +    if [[ -n "$untracked_changes" ]]; then +      untracked_changes=" $untracked_changes" +    fi + +    changes="$staged_changes$conflicted_changes$unstaged_changes$untracked_changes" +  fi +  echo $changes +} +  zsh_color_changes_status() {    local porcelain="$(porcelain_status)"    local changes="" @@ -18,6 +18,6 @@ else    local_behind=""  fi -prompt="$(branch_name)$local_behind$local_ahead $(zsh_color_changes_status)" +prompt="$(branch_name)$local_behind$local_ahead $(bash_color_changes_status)"  echo $prompt | 
