Skip to content

Commit

Permalink
Hook new stash_status in to render_prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldfallen committed Oct 16, 2015
1 parent 2091b01 commit 51b15bb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions radar-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -519,6 +519,7 @@ render_prompt() {
remote_sed=""
local_sed=""
changes_sed=""
stash_sed=""


if_pre="%\{([^%{}]{1,}:){0,1}"
Expand Down Expand Up @@ -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"
}

0 comments on commit 51b15bb

Please sign in to comment.