Re: [PATCH] Add some fancy colors in the test library when terminal supports it.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 23, 2007 at 04:08:14AM +0000, Christian Couder wrote:
> Hi Pierre,
> 
> Le lundi 22 octobre 2007, Pierre Habouzit a écrit :
> > +
> > +say_color () {
> > +	[ "$nocolor" = 0 ] &&  [ "$1" != '-1' ] && tput setaf "$1"
> > +	shift
> > +	echo "* $*"
> > +	tput op
> > +}
> > +
> >  error () {
> > -	echo "* error: $*"
> > +	say_color 9 "* error: $*"
> 
> This will print something like "* * error: ..." instead of "* error: ..."
> 
> The following should work:
> 
> > +	say_color 9 "error: $*"
> 
> By the way, where do the 9 here and the 10 and the -1 below come from ?
> "man 5 terminfo" says that only values form 0 to 7 are portably defined.
> Maybe 9 is a bold red and 10 a bold green, or something like that, but it 
> doesn't seem to work on my konsole.

Right I should use tput setb or sth like that to ask for bold mode
probably.

> Anyway, perhaps having:
> 
> _red=1
> _green=2
> 
> and then using "say_color $_red stuff" might be easier to understand and 
> change if needed.

Agreed.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@xxxxxxxxxx
OOO                                                http://www.madism.org

Attachment: pgp4XsyatsXeI.pgp
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux