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

Re: Unify subcommand structure; introduce double dashes for all subcommands?

From
Stefan Beller <stefanbeller@gmail.com>
Date
Aug 10, 2014, 21:08 UTC
Message-ID
<53E7DF33.50508@gmail.com>
In-Reply-To
<xmqqha1k8b6v.fsf@gitster.dls.corp.google.com>
On 10.08.2014 20:13, Junio C Hamano wrote:
Show 29 quoted lines
> Stefan Beller <stefanbeller@gmail.com> writes:
> 
>> On 23.07.2014 19:52, Junio C Hamano wrote:
>>
>>> 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.
> 
> That is not ideal at all, I am afraid.  A command that started only
> with its "primary operating mode", e.g. "git tag [-s|-a] tagname
> [object]", may have to gain "I do not want to create, I just want to
> list" and the way to signal that has to be an option that cannot be
> mistaken as its valid first argument (to avoid "git tag list" that
> cannot create a tag called "list", we use "git tag --list").  You
> could add an entirely new command "git foo" that always takes the
> command-mode word, i.e. "git foo mode$n args", but you will be
> typing the operating mode name all the time only to save --mode$n
> for 2<=$n, which may not be a good economy in the end.
> 
> Please do not go there.
> 
I see your point.
However how often do you really want to create a tag called list?
As of now it's easy:
	git tag list
and for listing all tags you'd need to type:
	git tag --list
and if you want to create a tag called --list, I'd assume you'd go
	git tag -- --list
	# However:
	fatal: '--list' is not a valid tag name.

So even as of now certain tag names cannot be done easily. Also you have to type two more dashes for an action you'd probably want to perform more often (as opposed to creating a tag 'list')

In my (ideal) world we'd rather have this behavior:
 	git tag list
	# behaves the same as
	git tag
Now creating a tag called 'list' is not as easy, because 'list' is a
primary operating mode name, so we need to tell git we're actually
meaning the name as opposed to the operating mode:
	git tag create -- list
	# or even
	git tag create -- --list

---- Anyways despite my arguing, it seems you rather want to rather have the leading double dashes everywhere for the operating modes? So the plan is to not touch the parsing, but to adjust notes and stash ?

Thanks, Stefan

Previous: Junio C Hamano
Message 5 of 5 in “Unify subcommand structure; introduce double dashes for all subcommands?”
  1. Stefan BellerJul 23, 2014
  2. Junio C HamanoJul 23, 2014
  3. Stefan BellerAug 10, 2014
  4. Junio C HamanoAug 10, 2014
  5. Stefan BellerAug 10, 2014

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.