summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild/msg-if.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/build/msg-if.sh b/build/msg-if.sh
index e0d0957..afb478c 100755
--- a/build/msg-if.sh
+++ b/build/msg-if.sh
@@ -14,8 +14,18 @@ set -eu
MSG="$1"
shift
+if [ -z "${NO_COLOR:-}" ] && [ -t 1 ]; then
+ Y='\033[1;32m✔\033[0m'
+ N='\033[1;31m✘\033[0m'
+else
+ Y='✔'
+ N='✘'
+fi
+
if "$@"; then
- build/msg.sh "$(printf '%-37s ✔' "$MSG")"
+ YN="$Y"
else
- build/msg.sh "$(printf '%-37s ✘' "$MSG")"
+ YN="$N"
fi
+
+build/msg.sh "$(printf "%-37s $YN" "$MSG")"