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.