From: Stefan Beller <stefanbeller@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: GIT Mailing-list <git@vger.kernel.org>
Subject: Re: Unify subcommand structure; introduce double dashes for all subcommands?
Date: Sun, 10 Aug 2014 17:26:30 +0200 [thread overview]
Message-ID: <53E78F26.3000701@gmail.com> (raw)
In-Reply-To: <xmqqiomodkt9.fsf@gitster.dls.corp.google.com>
On 23.07.2014 19:52, Junio C Hamano wrote:
> Stefan Beller <stefanbeller@gmail.com> writes:
>
>> A git command is generally setup as:
>> git <command> [<subcommand>] [<options>] ...
>>
>> The subcommands vary wildly by the nature of the command. However all
>> subcommands
>> could at least follow one style. The commands bundle, notes, stash and
>> submodule
>> have subcommands without two leading dashes (i.e. git stash list) as
>> opposed to all
>> other commands (i.e. git tag --list).
>
> Sounds familiar. E.g. here is a similar thread about a year ago.
>
> http://thread.gmane.org/gmane.comp.version-control.git/231376/focus=231478
>
> Further discussions to make the plan more concrete is very much
> welcomed.
>
> Thanks.
>
So I'd want to add have the subcommands without double dashes ideally.
It's just less typing and more english like, not cryptic with dashes.
This may come handy for newcomers/beginners using git. It also benefits
the powerusers of git as you spare the typing of 2 dashes on the subcommand.
I'm currently trying to understand the functions to parse options
and I wonder if the following is possible:
If there is an option set by OPT_CMDMODE
(such as git tag --delete / --verify) we want to add an internal option,
(such as PARSE_OPT_NODASH ?),
that you can deliver this CMD_MODE option without leading 2 dashes.
The current behavior with leading 2 dashes is still supported,
but maybe a warning is printed about deprecating the option with 2 dashes.
Having this change in place will switch over revert, replace, tag and merge-base
to having sane subcommands without dashes possible.
Once this change is in, we can rewrite the other commands,
which as of now don't require the dashes.
Coincidentally these commands heavily rely on option parsing themselves,
such as git-notes having this code in place:
if (argc < 1 || !strcmp(argv[0], "list"))
result = list(argc, argv, prefix);
else if (!strcmp(argv[0], "add"))
result = add(argc, argv, prefix);
else if (!strcmp(argv[0], "copy"))
result = copy(argc, argv, prefix);
...
Does that make sense?
Stefan
next prev parent reply other threads:[~2014-08-10 15:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-23 13:35 Unify subcommand structure; introduce double dashes for all subcommands? Stefan Beller
2014-07-23 17:52 ` Junio C Hamano
2014-08-10 15:26 ` Stefan Beller [this message]
2014-08-10 18:13 ` Junio C Hamano
2014-08-10 21:08 ` Stefan Beller
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=53E78F26.3000701@gmail.com \
--to=stefanbeller@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).