Skip to content

Commit

Permalink
Rename RAW_OUTPUT -> NO_COLOR
Browse files Browse the repository at this point in the history
Also, if NO_COLOR is empty, output will be colored, otherwise not colored.

Signed-off-by: Rishikesh Nair <alienware505@gmail.com>
  • Loading branch information
rishinair11 authored and brandond committed Mar 5, 2024
1 parent ff7cfa2 commit ce0765c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions contrib/util/check-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ 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
Expand Down Expand Up @@ -58,6 +55,10 @@ is_set_as_module() {
}

color() {
if [[ -n "$NO_COLOR" ]]; then
return
fi

codes=
if [ "$1" = 'bold' ]; then
codes=1
Expand All @@ -84,11 +85,6 @@ color() {
printf '\033['"$codes"'m'
}
wrap_color() {
if [ $RAW_OUTPUT -eq 1 ]; then
echo -n "$1"
return
fi

text="$1"
shift
color "$@"
Expand Down

0 comments on commit ce0765c

Please sign in to comment.