summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-06-11 13:51:13 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-06-11 13:51:13 +0200
commit04871fc90d2fe741717b842f63ff678221647653 (patch)
tree32ccef5e2b10948e97ee3c95ab325fa078047b53
parent962a7c47577311a6ee9c86973c2b3ac9b52259fe (diff)
Do not use colors & other escapes unless connected to a terminal
-rwxr-xr-xbin/ct13
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/ct b/bin/ct
index 6454fad..12b80d5 100755
--- a/bin/ct
+++ b/bin/ct
@@ -18,9 +18,11 @@ setopt extended_glob
typeset -a -U triggers
typeset -a PKG_ROOTS CL_OPTIONS
-c_info=$'\e[0;36m'
-c_error=$'\e[0;31m'
-c_reset=$'\e[0m'
+if [[ -t 1 ]] {
+ c_info=$'\e[0;36m'
+ c_error=$'\e[0;31m'
+ c_reset=$'\e[0m'
+}
## Basic output functions
@@ -118,6 +120,11 @@ if (( SILENT )) {
self=${0}
self_path=${PKG_DIR}/${${(s:/:)$(readlink ${self})}[-3]}
+if [[ ! -t 1 ]] {
+ PROGRESS=0
+ function clear_line {}
+}
+
if (( SILENT )) {
# The goal is not to override anything set by the user...
# So, an alias should be safer than fiddling with ${MAKEFLAGS}