Skip to content

Commit

Permalink
fix: respect NOCOLOR (-C)
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Oct 2, 2019
1 parent 5340593 commit 4ae4f0a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tusc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ declare -A HEADERS # assoc headers of last request
declare ISOK=0 # is last request ok?

# message helpers
line() { echo -e "\e[${3:-0};$2m$1\e[0m"; if [[ "$4" != "" ]]; then exit $4; fi }
line() {
[[ $NOCOLOR ]] && echo -e "$1" || echo -e "\e[${3:-0};$2m$1\e[0m"
[[ "$4" == "" ]] || exit $4
}
error() { line "$1" 31 0 $2; }
ok() { line "${1:- Done}" 32 0 $2; }
info() { line "$1" 33 0 $2; }
Expand Down

0 comments on commit 4ae4f0a

Please sign in to comment.