Honour NO_COLOR in bootstrap scrips, fixes #248

This commit is contained in:
Julian Ospald 2021-09-24 20:37:55 +02:00
parent ff2b06a5e8
commit d662682fb5
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F

View File

@ -52,11 +52,18 @@ esac
die() { die() {
if [ -n "${NO_COLOR}" ] ; then
(>&2 printf "%s\\n" "$1")
else
(>&2 printf "\\033[0;31m%s\\033[0m\\n" "$1") (>&2 printf "\\033[0;31m%s\\033[0m\\n" "$1")
fi
exit 2 exit 2
} }
warn() { warn() {
if [ -n "${NO_COLOR}" ] ; then
printf "%s\\n" "$1"
else
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*)
echo -e "\\033[0;35m$1\\033[0m" echo -e "\\033[0;35m$1\\033[0m"
@ -65,9 +72,13 @@ warn() {
printf "\\033[0;35m%s\\033[0m\\n" "$1" printf "\\033[0;35m%s\\033[0m\\n" "$1"
;; ;;
esac esac
fi
} }
yellow() { yellow() {
if [ -n "${NO_COLOR}" ] ; then
printf "%s\\n" "$1"
else
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*)
echo -e "\\033[0;33m$1\\033[0m" echo -e "\\033[0;33m$1\\033[0m"
@ -76,9 +87,13 @@ yellow() {
printf "\\033[0;33m%s\\033[0m\\n" "$1" printf "\\033[0;33m%s\\033[0m\\n" "$1"
;; ;;
esac esac
fi
} }
green() { green() {
if [ -n "${NO_COLOR}" ] ; then
printf "%s\\n" "$1"
else
case "${plat}" in case "${plat}" in
MSYS*|MINGW*) MSYS*|MINGW*)
echo -e "\\033[0;32m$1\\033[0m" echo -e "\\033[0;32m$1\\033[0m"
@ -87,6 +102,7 @@ green() {
printf "\\033[0;32m%s\\033[0m\\n" "$1" printf "\\033[0;32m%s\\033[0m\\n" "$1"
;; ;;
esac esac
fi
} }
edo() { edo() {