git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: Imran M Yousuf <imyousuf@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] Simplified the invocation of command action in submodule
Date: Wed, 09 Jan 2008 02:27:28 -0800	[thread overview]
Message-ID: <7vsl17i99r.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 47849B60.2060000@viscovery.net

Johannes Sixt <j.sixt@viscovery.net> writes:

> Imran M Yousuf schrieb:
>> On Jan 9, 2008 2:59 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:
>>> - Previously, passing --cached to add, init, or update was an error, now
>>> it is not.
>> 
>> The usage statement and this behaviour is rather contradicting. The
>> usage says that --cached can be used with all commands; so I am not
>> sure whether using --cached with add should be an error or not. IMHO,
>> if the previous implementation was right than the USAGE has to be
>> changed, and if the previous implementation was incorrect, than if the
>> default command is set to status than current implementation is right.
>
> I prefer that the usage statement lists one line per sub-command with the
> flags that apply only to the sub-command. IOW, a usage statement that
> suggests that a flag applies to all sub-commands when in reality it
> doesn't is bogus, IMHO.

I view the usage emitted by a command primarily as a quick
reminder for people who are _already_ familiar with the command
to help "was the option this command takes --foo or --bar?  I
can never remember which X-<" situation.  The usage string is
not a replacement of the manual page.  For that reason, I
generally prefer short and sweet one line usage for the whole
command, even if it does not exactly capture mutually
incompatible option combinations, _as long as_ the command
itself is simple enough.

As you said, however, git-submodule is a command dispatcher on
its own, and what its subcommands do are quite different, to the
point that they probably should not even be sharing the option
parser.  One line per subcommand feels more appropriate.

By the way, Imran, if the current implementation declares a
combination of "add" and "--cached" an error, and a new
implementation does not, that's called a regression.  Unless you
can prove that the combination makes sense and the existing
behaviour is a bug, in which case you can say the new
implementation fixes the bug.

In this case, module_add does not even pay attention to $cached
in the existing code.  The choice is between (1) silently ignore
user's expectation that "add --cached" would do something
different from "add" without "--cached", or (2) tell the user
that the combination does not make sense and error out.  To
people who _know_ what the command does, the choice between the
two does not make much difference (they do not give ignored
option, nor trigger the error), but to new people the latter is
often easier to use.

  parent reply	other threads:[~2008-01-09 10:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-09  3:59 [PATCH] Simplified the invocation of command action in submodule imyousuf
2008-01-09  8:19 ` Junio C Hamano
2008-01-09  8:23   ` Imran M Yousuf
2008-01-09  8:59 ` Johannes Sixt
2008-01-09  9:07   ` Imran M Yousuf
2008-01-09  9:15     ` Johannes Sixt
2008-01-09  9:51   ` Imran M Yousuf
2008-01-09 10:01     ` Johannes Sixt
2008-01-09 10:06       ` Imran M Yousuf
2008-01-09 10:27       ` Junio C Hamano [this message]
2008-01-09 10:24     ` Lars Hjemli
2008-01-10  3:05       ` Imran M Yousuf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vsl17i99r.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=imyousuf@gmail.com \
    --cc=j.sixt@viscovery.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).