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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El 23/11/2007, a las 20:59, Junio C Hamano escribió:

Jakub Narebski <jnareb@xxxxxxxxx> writes:

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


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux