From 04871fc90d2fe741717b842f63ff678221647653 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 11 Jun 2010 13:51:13 +0200 Subject: Do not use colors & other escapes unless connected to a terminal --- bin/ct | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'bin') 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} -- cgit v1.2.3