Jeff King <peff@xxxxxxxx> writes: > On Thu, Nov 22, 2007 at 04:56:06AM -0600, Dan Zwell wrote: > >> + # Grab the 3 main colors in git color string format, with sane >> + # (visible) defaults: >> + $prompt_color = Git::color_to_ansi_code( >> + scalar $repo->config_default('color.interactive.prompt', >> + 'bold blue')); > > And by the same token as the last message, given that config_* take only > two arguments, is there a reason not to extend them so that > > $repo->config_bool('my.key', 0); > > handles the default. Then I think you could simplify this to just: > > $repo->config_color('color.interactive.prompt', 'bold blue'); > > and hide the color_to_ansi_code messiness from the script altogether. I like the config_color() method. I think the "config_bool with default" also makes sense but it needs to be coded a bit carefully. Issues to consider: (1) Non default form "$r->config_bool('key')" should keep the original semantics; missing key in the configuration is the same as false (i.e. "undef" in scalar, () in list context). (2) What should be the second parameter in the form to default to true? '1'? 'true'? Any kind of "true" value in Perl should be accepted? (3) Same question as (2) but for defaulting to false. Any kind of "false"? - 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