diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2010-06-11 13:51:13 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2010-06-11 13:51:13 +0200 |
commit | 04871fc90d2fe741717b842f63ff678221647653 (patch) | |
tree | 32ccef5e2b10948e97ee3c95ab325fa078047b53 | |
parent | 962a7c47577311a6ee9c86973c2b3ac9b52259fe (diff) |
Do not use colors & other escapes unless connected to a terminal
-rwxr-xr-x | bin/ct | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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} |