Jakub Narebski [off-list ref] 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?
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
On Fri, Nov 23, 2007 at 11:59:25AM -0800, Junio C Hamano wrote:
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?
We would also need a way of parsing the 'default' values, so git-config
would need a way of saying "turn this value into its internal
representation" (or the perl script would have to specify its defaults
as raw ANSI codes, which is a bit ugly, but is that the C programs do).
-Peff