From: Christian Couder Date: Fri, 29 May 2015 11:34:50 GMT Subject: Re: [PATCH v2 1/2] config: add options to list only variable names Message-ID: In-Reply-To: On Thu, May 28, 2015 at 9:20 PM, Junio C Hamano wrote: > SZEDER Gábor writes: > >> @@ -16,11 +16,12 @@ SYNOPSIS >> 'git config' [] [type] [-z|--null] --get-all name [value_regex] >> 'git config' [] [type] [-z|--null] --get-regexp name_regex [value_regex] >> 'git config' [] [type] [-z|--null] --get-urlmatch name URL >> +'git config' [] [-z|--null] --get-name-regexp name_regex >> ... > > At first I wondered why --get-name-regexp is needed, as (purely from > the syntactic level) it appeared at the first glance the existing > '--get-regexp' without 'value_regex' may be sufficient, until I read > this: > >> +--get-name-regexp:: >> + Like --get-regexp, but shows only matching variable names, not its >> + values. > > which makes it clear why it is needed. The distinction is purely > about the output, i.e. the values are omitted. If the distinction is purely about the output, then it seems logical to add only an output related option, like the --name-only option I suggested, and not 2 new modes (--get-name-regexp and --list-names). Doesn't it look like git config already has too many modes? > But then it makes me wonder why --get-name-regexp shouldn't > optionally accept value_regex like --get-regexp does, allowing you > to say "list the variables that match this pattern whose values > match this other pattern". I know it may be a feature that is > unnecessary for your purpose, but from a cursory look of the patch > text, you do not seem to be doing anything different between > get-regexp and get-name-regexp codepaths other than flipping > omit_values bit on, so it could be that the feature is already > supported but forgot to document it, perhaps? This also suggests that it might be more logical to only add an option called --name-only or --omit-values that would map directly to the omit_values bit in the code.