Skip to content

Commit 4ae4f0a

Browse files
committed
fix: respect NOCOLOR (-C)
1 parent 5340593 commit 4ae4f0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tusc.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ declare -A HEADERS # assoc headers of last request
1616
declare ISOK=0 # is last request ok?
1717

1818
# message helpers
19-
line() { echo -e "\e[${3:-0};$2m$1\e[0m"; if [[ "$4" != "" ]]; then exit $4; fi }
19+
line() {
20+
[[ $NOCOLOR ]] && echo -e "$1" || echo -e "\e[${3:-0};$2m$1\e[0m"
21+
[[ "$4" == "" ]] || exit $4
22+
}
2023
error() { line "$1" 31 0 $2; }
2124
ok() { line "${1:- Done}" 32 0 $2; }
2225
info() { line "$1" 33 0 $2; }

0 commit comments

Comments
 (0)