git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Wincent Colaiuta <win@wincent.com>
Date
Nov 23, 2007, 20:57 UTC
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ó:
Show 11 quoted lines
> Jakub Narebski <jnareb@gmail.com> 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

Previous: Junio C HamanoNext: Jeff King
Message 3 of 6 in “Add config_int() method to the Git perl module”
  1. Add config_int() method to the Git perl moduleJakub Narebski, Nov 23, 2007
  2. Junio C HamanoNov 23, 2007
  3. Wincent ColaiutaNov 23, 2007
  4. Jeff KingNov 24, 2007
  5. git-config --get-color: get configured colorJunio C Hamano, Nov 28, 2007
  6. Dan ZwellNov 28, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.