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

Re: [RFC/PATCH 1/2] submodule: implement `module_list` as a builtin helper

From
Stefan Beller <sbeller@google.com>
Date
Aug 3, 2015, 22:13 UTC
Message-ID
<CAGZ79kZL2S2jJ8HmQP6Es_4=5nCt=MwpcDcB0RPv7Yw=1NDodA@mail.gmail.com>
In-Reply-To
<xmqqbneo6nas.fsf@gitster.dls.corp.google.com>
On Mon, Aug 3, 2015 at 3:04 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 41 quoted lines
> Stefan Beller <sbeller@google.com> writes:
>
>> On Fri, Jul 31, 2015 at 6:01 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Stefan Beller <sbeller@google.com> writes:
>>>
>>>> +static const char * const git_submodule_helper_usage[] = {
>>>> +     N_("git submodule--helper --module_list [<path>...]"),
>>>
>>> Yuck.  Please do not force --multi_word_opt upon us, which is simply
>>> too ugly to live around here.  --module-list is perhaps OK,
>>
>> I agree there. The way you word it here, it sounds as if the mixture
>> of dashes and underscores are a problem.
>>
>>> but
>>> because submodule--helper would not have an default action, I'd
>>> prefer to make these just "command words", i.e.
>>>
>>>     $ git submodule--helper module_list
>>
>> Why would you use an underscore in here as opposed to a dash?
>>      $ git submodule--helper module-list
>>
>> I went with --module-list for now as I see no reason real to make it
>> a command word for now ...
>
> The biggest reason why we should not add more --command-mode is to
> avoid confusion (and copy & paste misdesign by others).  If you use
> the command-word interface, it is crystal clear that
>
>  (1) the word 'module_list' must be the first token after the
>      subcommand name, no need to parse "subcmd --opt --cmd", and
>      mislead the users to think incorrectly that ...
>
>  (2) ... "cmd --optA --cmd1 --optB --cmd2" might be allowed, which
>      would lead you to add code to reject, saying "cmd1 and cmd2 are
>      incompatible".
>
> So I'd prefer to see it fixed before you start supporting more
> commands in submodule--helper.  It will need unnecessary patch noise
> to fix it later.

So we had this discussion some time ago [1] and my understanding from back then was to rather have --command-mode instead of subcommand words because that's what most git commands use nowadays, so we don't want to add more of the competing style. It's also easier to work with as we have a powerful option parsing implementation.

It seems your opinion has swayed. I'll change it then.
[1] $gmane/254076 or $gmane/231376/focus=231478
Previous: Junio C HamanoNext: Stefan Beller
Message 10 of 15 in “add: remove dead code”
  1. add: remove dead codeStefan Beller, Jul 31, 2015
  2. Junio C HamanoJul 31, 2015
  3. 0/2 Submodules: refactoring the `module_list` functionStefan Beller, Jul 31, 2015
  4. 1/2 submodule: implement `module_list` as a builtin helperStefan Beller, Jul 31, 2015
  5. Junio C HamanoAug 1, 2015
  6. Stefan BellerAug 3, 2015
  7. Junio C HamanoAug 3, 2015
  8. submodule: implement `module_list` as a builtin helperStefan Beller, Aug 3, 2015
  9. Junio C HamanoAug 3, 2015
  10. Stefan BellerAug 3, 2015
  11. submodule: implement `module_list` as a builtin helperStefan Beller, Aug 3, 2015
  12. 2/2 Testing the new codeStefan Beller, Jul 31, 2015
  13. Junio C HamanoAug 1, 2015
  14. Stefan BellerAug 3, 2015
  15. Junio C HamanoAug 3, 2015

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.