Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: [PATCH] Add config_int() method to the Git perl module

From: Wincent Colaiuta <hidden>
Date: 2016-06-15 22:43:53

El 23/11/2007, a las 20:59, Junio C Hamano escribió:
Jakub Narebski [off-list ref] writes:
quoted
Integer variables can have optional 'k', 'm' or 'g' suffix.
config_int() method will return simple decimal number, taking
care of those suffixes.
Good.  I forgot about --int option to "git config" already.

Maybe in a similar way, we might want to add --color to "git
config" to return ANSI sequence, so that Git::config_color() can
work without even loading Term::ANSIColor?
Or failing that, it would be very easy to remove the dependency on  
Term::ANSIColor by adding something like this to Git.pm:

+my $COLOR = {
+       "reset"         => "\e[0m",
+       "normal"        => "",
+       "black"         => "\e[30m",
+       "red"           => "\e[31m",
+       "green"         => "\e[32m",
+       "yellow"        => "\e[33m",
+       "blue"          => "\e[34m",
+       "magenta"       => "\e[35m",
+       "cyan"          => "\e[36m",
+       "white"         => "\e[37m",
+       "bold"          => "\e[1m",
+       "ul"            => "\e[4m",
+       "blink"         => "\e[5m",
+       "reverse"       => "\e[7m",
+       "on_red"        => "\e[41m",
+};
+
+sub color {
+       my $desired_color = shift;
+       return $COLOR->{$desired_color} || "";
+}

Cheers,
Wincent
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help