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

Re: [RFC] notes: attach help text to subcommands

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 8, 2012, 14:49 UTC
Message-ID
<7vd359eu4s.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1339145776-20495-1-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
> +	string_list_insert(&subcmds, "list")->util = &util[0];
> +	string_list_insert(&subcmds, "add")->util = &util[1];
> ...

If you make "struct subcommand" to contain entry's own name, you could simply do this, no?

	for (i = 0; i < ARRAY_SIZE(util); i++)
        	string_list_insert(&subcmds, util[i].name)->util = &util[i];
Perhaps append all and then sort once at the end?
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 6 of 13 in “parse-options: introduce parse_subcommands”
  1. parse-options: introduce parse_subcommandsRamkumar Ramachandra, Jun 4, 2012
  2. Junio C HamanoJun 4, 2012
  3. Ramkumar RamachandraJun 6, 2012
  4. Junio C HamanoJun 6, 2012
  5. [RFC] notes: attach help text to subcommandsRamkumar Ramachandra, Jun 8, 2012
  6. Junio C HamanoJun 8, 2012
  7. notes: attach help text to subcommandsRamkumar Ramachandra, Jun 8, 2012
  8. Jonathan NiederJun 8, 2012
  9. Felipe ContrerasJun 8, 2012
  10. Ramkumar RamachandraJun 8, 2012
  11. Felipe ContrerasJun 13, 2012
  12. Junio C HamanoJun 8, 2012
  13. Jonathan NiederJun 5, 2012

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.