From b7e429b1f894d0c0da9ea12b9f50b0ee50321cf9 Mon Sep 17 00:00:00 2001 From: Travis Swicegood Date: Tue, 1 May 2012 17:25:47 -0500 Subject: [PATCH] optimize this a bit --- themes/doubletime/doubletime.theme.bash | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/themes/doubletime/doubletime.theme.bash b/themes/doubletime/doubletime.theme.bash index a01bf79..87ced7e 100644 --- a/themes/doubletime/doubletime.theme.bash +++ b/themes/doubletime/doubletime.theme.bash @@ -59,14 +59,15 @@ $(doubletime_scm_prompt)$reset_color $ " PROMPT_COMMAND=prompt_setter git_prompt_status() { - - if [ -n "$(git status | grep 'Changes not staged' 2> /dev/null)" ]; then + local git_status_output + git_status_output=$(git status 2> /dev/null ) + if [ -n "$(echo $git_status_output | grep 'Changes not staged')" ]; then git_status="${bold_red}$(scm_prompt_info) ✗" - elif [ -n "$(git status | grep 'Changes to be committed' 2> /dev/null)" ]; then + elif [ -n "$(echo $git_status_output | grep 'Changes to be committed')" ]; then git_status="${bold_yellow}$(scm_prompt_info) ^" - elif [ -n "$(git status | grep 'Untracked files' 2> /dev/null)" ]; then + elif [ -n "$(echo $git_status_output | grep 'Untracked files')" ]; then git_status="${bold_cyan}$(scm_prompt_info) +" - elif [ -n "$(git status | grep 'nothing to commit' 2> /dev/null)" ]; then + elif [ -n "$(echo $git_status_output | grep 'nothing to commit')" ]; then git_status="${bold_green}$(scm_prompt_info) ${green}✓" else git_status="$(scm_prompt_info)" -- 2.17.1