summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgit-sonar20
1 files changed, 11 insertions, 9 deletions
diff --git a/git-sonar b/git-sonar
index 9aa2233..50f443c 100755
--- a/git-sonar
+++ b/git-sonar
@@ -68,15 +68,17 @@ precheck_status=$?
# Initialize configuration variables and set default values if not provided by
# the environment. Note: ANSI escape codes (and other unprintable sequences)
-# must be enclosed by a \001 byte (ASCII start of heading) at the start and a
-# \002 byte (ASCII start of text) at the end - some shells rely on this to
-# correctly track the length of their rendered prompt.
-COLOR_GRAY="\\001\\033[1;30m\\002"
-COLOR_RED="\\001\\033[1;31m\\002"
-COLOR_GREEN="\\001\\033[1;32m\\002"
-COLOR_YELLOW="\\001\\033[1;33m\\002"
-COLOR_WHITE="\\001\\033[1;37m\\002"
-COLOR_DEF="${GIT_SONAR_DEFAULT_COLOR:-"\\001\\033[0m\\002"}"
+# usually need to be enclosed within a pair of markers to help the user's shell
+# correctly track the length of the rendered prompt and handle text wrapping.
+# These default markers are for bash.
+CS="${GIT_SONAR_COLOR_PREFIX:-"\\001"}" # ASCII start of heading
+CE="${GIT_SONAR_COLOR_SUFFIX:-"\\002"}" # ASCII start of text
+COLOR_DEF="${GIT_SONAR_DEFAULT_COLOR:-"${CS}\\033[0m${CE}"}"
+COLOR_GRAY="${CS}\\033[1;30m${CE}"
+COLOR_RED="${CS}\\033[1;31m${CE}"
+COLOR_GREEN="${CS}\\033[1;32m${CE}"
+COLOR_YELLOW="${CS}\\033[1;33m${CE}"
+COLOR_WHITE="${CS}\\033[1;37m${CE}"
FETCH_TIME="${GIT_SONAR_FETCH_TIME:-"300"}"