Cc: Dan Zwell <dzwell@...>, Shawn O. Pearce <spearce@...>, Git Mailing List <git@...>, Jonathan del Strother <maillist@...>, Johannes Schindelin <Johannes.Schindelin@...>, Frank Lichtenheld <frank@...>
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