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

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Pierre Habouzit <madcoder@...>
Cc: Shawn O. Pearce <spearce@...>, <git@...>
Date: Monday, October 22, 2007 - 4:53 am

Pierre Habouzit schrieb:

test "x$TERM" != "xdumb" &&
	tput hpa 60 >/dev/null 2>&1 &&
	tput setaf 1 >/dev/null 2>&1 &&
	color=t

BTW, doesn't tput fail if stdout/stderr is not a terminal, like above?


What if tput is not available, like on Windows? How about this (at the end 
of the file, so it can obey --no-color):

if test "$color"; then
	say_color () {
		test "$1" != '-1' && tput setaf "$1"
		shift
		echo "* $*"
		tput op
	}
else
	say_color() {
		shift
		echo "* $*"
	}
fi


	    color=; shift ;;

-- Hannes "We don't need no double negation"
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] Add some fancy colors in the test library when t..., Christian Couder, (Tue Oct 23, 12:08 am)
Re: [PATCH] Add some fancy colors in the test library when t..., Johannes Sixt, (Mon Oct 22, 4:53 am)