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

Re: [PATCH] - Updated usage and simplified sub-command action invocation

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 12, 2008, 01:38 UTC
Message-ID
<7vk5mfzutq.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<7bfdc29a0801092341j60dcb081xe4bf6c22cbaf30f2@mail.gmail.com>
"Imran M Yousuf" <imyousuf@gmail.com> writes:
Show 9 quoted lines
>> > Actually module_$command is not possible because only add's module is
>> > module_add rest are modules_$command....
>>
>> Is there a fundamental reason why you cannot rename them to be
>> more consistent?
>
> In fact it is consistent, add works on a single module only, whereas
> rest of the command works either on 1 or more. Thus having plural
> (modules) is logical.

It certainly is consistent in _that_ meaning of the word, but I was not talking about that consistency, which is less useful in this context.

The consistency I was talking about was "A subcommand called $foo is always handled by a shell function called cmd_$foo". That is also a consistency, and it is of much more useful kind in a situation like this, namely, a command dispatcher.

If you have show_blobs() and show_commit() subroutines, former of which takes 1 or more blobs while the latter of which can only take 1 commit, being consistent in your meaning might help the programmers avoiding a mistake to pass two or more commits to a non-existent show_commits(). In that sense, your kind of consistency is not totally useless.

However, it is not so useful in a context where there is one call site for each of the functions, like a command dispatcher scenario.

Previous: Imran M YousufNext: Imran M Yousuf
Message 6 of 7 in “- Updated usage and simplified sub-command action invocation”
  1. - Updated usage and simplified sub-command action invocationimyousuf@gmail.com, Jan 10, 2008
  2. Junio C HamanoJan 10, 2008
  3. Imran M YousufJan 10, 2008
  4. Junio C HamanoJan 10, 2008
  5. Imran M YousufJan 10, 2008
  6. Junio C HamanoJan 12, 2008
  7. Imran M YousufJan 11, 2008

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.