From: Wincent Colaiuta Date: Fri, 23 Nov 2007 20:57:20 GMT Subject: Re: [PATCH] Add config_int() method to the Git perl module Message-ID: <5B17707B-115E-45C8-895F-BD7020A3355A@wincent.com> In-Reply-To: <7vabp4u40y.fsf@gitster.siamese.dyndns.org> El 23/11/2007, a las 20:59, Junio C Hamano escribió: > Jakub Narebski 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