From ff81da4feb9a89f2f45941bf60f22b89e8047258 Mon Sep 17 00:00:00 2001 From: Rishi Date: Tue, 6 Feb 2024 13:15:26 +0530 Subject: [PATCH] Disable color outputs using RAW_OUTPUT env var Setting this environment variable will not wrap the text in color ANSI code, so that we can print a raw output. Signed-off-by: Rishikesh Nair (cherry picked from commit ff7cfa22351c76c8537c89a127daa41e2afe1a3a) Signed-off-by: Brad Davidson --- contrib/util/check-config.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/contrib/util/check-config.sh b/contrib/util/check-config.sh index 16d743720a..f70435a8e2 100755 --- a/contrib/util/check-config.sh +++ b/contrib/util/check-config.sh @@ -21,6 +21,9 @@ binDir=$(dirname "$0") configFormat=gz isError=0 +# RAW_OUTPUT=1 disables colored outputs +RAW_OUTPUT=${RAW_OUTPUT:-0} + if [ $# -gt 0 ]; then CONFIG="$1" fi @@ -81,6 +84,11 @@ color() { printf '\033['"$codes"'m' } wrap_color() { + if [ $RAW_OUTPUT -eq 1 ]; then + echo -n "$1" + return + fi + text="$1" shift color "$@"