summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgit-sonar14
1 files changed, 5 insertions, 9 deletions
diff --git a/git-sonar b/git-sonar
index 9fd3264..66648f3 100755
--- a/git-sonar
+++ b/git-sonar
@@ -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
}