slitaz-base-files rev 174

Colorize DEBUG and let use --decolor=NB
author Christophe Lincoln <pankso@slitaz.org>
date Thu May 17 14:53:51 2012 +0200 (2012-05-17)
parents 207fe5fca40a
children fa75f9c09dd8
files rootfs/lib/libtaz.sh
line diff
     1.1 --- a/rootfs/lib/libtaz.sh	Thu May 17 09:10:39 2012 +0200
     1.2 +++ b/rootfs/lib/libtaz.sh	Thu May 17 14:53:51 2012 +0200
     1.3 @@ -18,8 +18,9 @@
     1.4  # Internal variables.
     1.5  okmsg="$(gettext "Done")"
     1.6  ermsg="$(gettext "Failed")"
     1.7 -okcolor=32
     1.8 -ercolor=31
     1.9 +: ${okcolor=32}
    1.10 +: ${ercolor=31}
    1.11 +: ${decolor=36}
    1.12  
    1.13  # Parse cmdline options and store values in a variable.
    1.14  for opt in "$@"
    1.15 @@ -96,7 +97,7 @@
    1.16  	unset color
    1.17  }
    1.18  
    1.19 -# Indent text $1 spaces
    1.20 +# Indent text $1 spaces.
    1.21  indent() {
    1.22  	local in="$1"
    1.23  	shift
    1.24 @@ -111,8 +112,9 @@
    1.25  	fi
    1.26  }
    1.27  
    1.28 +# Display debug info when --debug is used.
    1.29  debug() {
    1.30 -	[ "$debug" ] && echo "DEBUG: $1"
    1.31 +	[ "$debug" ] && echo "$(colorize "DEBUG:" $decolor) $1"
    1.32  }
    1.33  
    1.34  # Gettextize yes/no.