git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Pierre Habouzit <madcoder@debian.org>
Date
Oct 23, 2007, 08:13 UTC
Message-ID
<20071023081327.GA21334@artemis.corp>
In-Reply-To
<200710230608.15124.chriscool@tuxfamily.org>
On Tue, Oct 23, 2007 at 04:08:14AM +0000, Christian Couder wrote:
Show 25 quoted lines
> 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.

Show 7 quoted lines
> 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@debian.org
OOO                                                http://www.madism.org
Previous: Johannes Sixt
Message 10 of 10 in “Add some fancy colors in the test library when terminal supports it.”
  1. Add some fancy colors in the test library when terminal supports it.Pierre Habouzit, Oct 22, 2007
  2. Johannes SixtOct 22, 2007
  3. Pierre HabouzitOct 22, 2007
  4. Johannes SixtOct 22, 2007
  5. Pierre HabouzitOct 22, 2007
  6. Johannes SixtOct 22, 2007
  7. Pierre HabouzitOct 22, 2007
  8. Christian CouderOct 23, 2007
  9. Johannes SixtOct 23, 2007
  10. Pierre HabouzitOct 23, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.