diff options
| -rwxr-xr-x | git-sonar | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -230,19 +230,15 @@ element_status() { # Main functions -IF_PRE="%\{([^%{}]{1,}:){0,1}" -IF_POST="(:[^%{}]{1,}){0,1}\}" SED_PRE="%{\(\([^%^{^}]*\)\:\)\{0,1\}" SED_POST="\(\:\([^%^{^}]*\)\)\{0,1\}}" prepare_element() { - if echo "$PROMPT_FORMAT" | grep -qE "${IF_PRE}${1}${IF_POST}"; then - result="$($2 | sed -e 's/\//\\\//g')" - if [ -n "$result" ]; then - printf '%b' "s/${SED_PRE}${1}${SED_POST}/\\\\2${result}\\\\4/" - else - printf '%b' "s/${SED_PRE}${1}${SED_POST}//" - fi + result="$($2 | sed 's/\//\\\//g')" + if [ -n "$result" ]; then + printf '%b' "s/${SED_PRE}${1}${SED_POST}/\\\\2${result}\\\\4/" + else + printf '%b' "s/${SED_PRE}${1}${SED_POST}//" fi } |
