Re: [PATCH 1/2] Added basic color support to git add --interactive

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jeff King <peff@...>
Cc: Dan Zwell <dzwell@...>, Shawn O. Pearce <spearce@...>, Git Mailing List <git@...>, Jonathan del Strother <maillist@...>, Johannes Schindelin <Johannes.Schindelin@...>, Frank Lichtenheld <frank@...>
Date: Tuesday, October 23, 2007 - 2:28 am

El 23/10/2007, a las 6:03, Jeff King escribió:


I did too, where you add a third, optional "trailer" parameter to the  
function where you pass the newline if there is one (following the  
style of the functions in color.c). Pasting it below.

Having said that, I think this kind of function belongs in Git.pm,  
and the dependency on Term::ANSIColor should be replaced with  
dependency-free code that generates the colors itself; this should be  
easy because the number of possible colors is small, Git thus far  
only uses a subset of the possible ANSI colors, and the C code for  
doing it is already there in color.c and just needs to be translated  
into Perl.

sub print_ansi_color {
	my $color = shift;
	my $string = shift;
	my $trailer = shift;
	if ($use_color) {
		print Term::ANSIColor::color($color), $string,
		    Term::ANSIColor::color('clear');
	} else {
		print $string;
	}
	if ($trailer) {
		print $trailer;
	}
}

Cheers,
Wincent



-
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:
[PATCH] Color support added to git-add--interactive., Dan Zwell, (Sat Oct 13, 12:13 am)
Re: [PATCH] Color support added to git-add--interactive., Johannes Schindelin, (Sat Oct 13, 8:25 am)
Re: [PATCH] Color support added to git-add--interactive., Frank Lichtenheld, (Sat Oct 13, 8:49 am)
Re: [PATCH] Color support added to git-add--interactive., Wincent Colaiuta, (Sat Oct 13, 10:45 am)
Re: [PATCH] Color support added to git-add--interactive., Johannes Schindelin, (Sat Oct 13, 12:38 pm)
Re: [PATCH] Color support added to git-add--interactive., Jean-Luc Herren, (Sat Oct 13, 12:38 pm)
Re: [PATCH] Color support added to git-add--interactive., Wincent Colaiuta, (Sat Oct 13, 1:14 pm)
Re: [PATCH] Color support added to git-add--interactive., Andreas Ericsson, (Sat Oct 13, 2:31 pm)
Re: [PATCH] Color support added to git-add--interactive., Wincent Colaiuta, (Sat Oct 13, 4:36 pm)
Re: [PATCH] Color support added to git-add--interactive., Jean-Luc Herren, (Sat Oct 13, 6:23 pm)
[PATCH 0/3] Adding colors to git-add--interactive, Dan Zwell, (Sat Nov 10, 10:21 pm)
[PATCH 0/3] Adding colors to git-add--interactive, Dan Zwell, (Sat Nov 10, 8:01 pm)
[PATCH 0/5] Colors for git-add--interactive, Dan Zwell, (Thu Nov 22, 6:54 am)
Re: [PATCH 0/5] Colors for git-add--interactive, Junio C Hamano, (Thu Nov 22, 3:20 pm)
Re: [PATCH 0/5] Colors for git-add--interactive, Jeff King, (Thu Nov 22, 7:57 am)
Re: [PATCH 0/3] Adding colors to git-add--interactive, Junio C Hamano, (Sun Nov 11, 4:23 am)
Re: [PATCH 1/2] Added basic color support to git add --inter..., Wincent Colaiuta, (Tue Oct 23, 2:28 am)