clickhouse-test: enable color hiliting only when stdout is a tty [#METR-11873].

This commit is contained in:
Alexey Milovidov 2014-07-10 22:58:04 +04:00
parent 4c7226627c
commit 247d7074e9

View File

@ -7,12 +7,19 @@
QUERIES_DIR="./queries"
CLIENT_PROGRAM="clickhouse-client -n"
COLOR_RESET="\033[0m"
COLOR_WHITE="\033[1;37m"
COLOR_FAIL="\033[1;31m"
COLOR_UNKNOWN="\033[1;30m"
COLOR_OK="\033[1;32m"
if [ -t 1 ]; then # stdout - терминал.
COLOR_RESET="\033[0m"
COLOR_WHITE="\033[1;37m"
COLOR_FAIL="\033[1;31m"
COLOR_UNKNOWN="\033[1;30m"
COLOR_OK="\033[1;32m"
else
COLOR_RESET=""
COLOR_WHITE=""
COLOR_FAIL=""
COLOR_UNKNOWN=""
COLOR_OK=""
fi
MSG_FAIL="${COLOR_WHITE}[ ${COLOR_FAIL}FAIL${COLOR_WHITE} ]${COLOR_RESET}"
MSG_UNKNOWN="${COLOR_WHITE}[ ${COLOR_UNKNOWN}UNKNOWN${COLOR_WHITE} ]${COLOR_RESET}"