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 22, 2007, 12:11 UTC
Message-ID
<20071022121106.GA7151@artemis.corp>
In-Reply-To
<471C8B02.6080202@viscovery.net>
On Mon, Oct 22, 2007 at 11:35:30AM +0000, Johannes Sixt wrote:
Show 20 quoted lines
> Pierre Habouzit schrieb:
> >On Mon, Oct 22, 2007 at 08:53:36AM +0000, Johannes Sixt wrote:
> >>Pierre Habouzit schrieb:
> >>>+say_color () {
> >>>+	[ "$nocolor" = 0 ] &&  [ "$1" != '-1' ] && tput setaf "$1"
> >>>+	shift
> >>>+	echo "* $*"
> >>>+	tput op
> >>>+}
> >>What if tput is not available, like on Windows? How about this (at the 
> >>end of the file, so it can obey --no-color):
> >  I answered to it already in my first mail: if tput isn't available,
> >the command fails, and $? is non 0. and nocolor is set. Or color isn't
> >set to 't' for your proposal.
> 
> I was too terse, sorry. I wanted to point out that if tput is not 
> available, the second invocation will leave "tput: command not found" 
> behind on stderr. Therefore, I proposed to make the definition of 
> say_color() different depending on whether $color is set or not. Then you 
> don't need to test for $color twice inside the function.
  Right we can do that. I'll try to rework the patch. and no it
shouldn't leave tput: command not found as I 2>/dev/null and I think the
shell doesn't print that in that case. At least my zsh doesn't.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org
Previous: Johannes SixtNext: Johannes Sixt
Message 5 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.