Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
QA: disable color output in non-interactive mode
Browse files Browse the repository at this point in the history
  • Loading branch information
amerlyq authored and albfan committed Dec 17, 2015
1 parent 55d79f4 commit 21bb1e5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ in v) VERBOSE=1
esac; done; shift $((OPTIND-1));


color() { printf "%s" "$(tput setaf $1)${@:2}$(tput sgr0)"; }
if [[ -t 1 ]]; then
color() { printf "%s" "$(tput setaf $1)${@:2}$(tput sgr0)"; }
else
color() { printf "%s" "${@:2}"; }
fi

show() {
printf "$(color ${1%% *} '[%7s] -%s-') %s %s\n" \
"${1#* }" "$2" "$(color $3)" "$4";
Expand Down

0 comments on commit 21bb1e5

Please sign in to comment.