cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 4d491fea7ef3061e9a042b168858132ec6180eea
parent b9f10c062a1d56c29c3b12b7f9be49ed08415897
Author: Cem Keylan <cem@ckyln.com>
Date:   Thu,  7 May 2020 20:30:35 +0300

kiss: change colour escape behaviour to be enabled and disabled.

This adds the ability for globally enabling or disabling colour
escapes.

Diffstat:
Mkiss | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/kiss b/kiss @@ -1426,9 +1426,6 @@ args() { log "Retrieving post-installation message queue" unset msg - [ "$KISS_COLOUR" ] || [ -t 1 ] && - colour=1 - for pkg in $order; do if [ -f "$sys_db/$pkg/message" ]; then printf '%s\n%b%s%b\n%s\n\n' \ @@ -1444,8 +1441,6 @@ args() { e|extension) log "Installed extensions" - [ "$KISS_COLOUR" ] || - [ -t 1 ] && colour=1 set -- @@ -1577,10 +1572,15 @@ main() { "${bin_dir:=$cac_dir/bin}" # Disable colour escape sequences if running in a subshell. - # This behaviour can be disabled by adding a KISS_COLOUR - # variable to the environment. - [ "$KISS_COLOUR" ] || [ -t 1 ] || + # This behaviour can be changed by adding a KISS_COLOUR + # variable to the environment. If it is set to 1 it will + # always enable colour escapes, and if set to 0 it will + # always disable colour escapes. + if [ "$KISS_COLOUR" = 1 ]; then colour=1 + elif [ "$KISS_COLOUR" = 0 ] || [ -t 0 ]; then log() { printf '%s %s %s\n' "${3:-->}" "$1" "$2" >&2 ;} + else colour=1 + fi args "$@" }