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

Re: [PATCH v3 1/5] doc: add documentation for OPT_STRING_LIST

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 18, 2017, 19:45 UTC
Message-ID
<xmqq37gg9moc.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170118000930.5431-2-jacob.e.keller@intel.com>
Jacob Keller <jacob.e.keller@intel.com> writes:
Show 26 quoted lines
> From: Jacob Keller <jacob.keller@gmail.com>
>
> Commit c8ba16391655 ("parse-options: add OPT_STRING_LIST helper",
> 2011-06-09) added the OPT_STRING_LIST as a way to accumulate a repeated
> list of strings. However, this was not documented in the
> api-parse-options documentation. Add documentation now so that future
> developers may learn of its existence.
>
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> ---
>  Documentation/technical/api-parse-options.txt | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
> index 27bd701c0d68..6914f54f5f44 100644
> --- a/Documentation/technical/api-parse-options.txt
> +++ b/Documentation/technical/api-parse-options.txt
> @@ -168,6 +168,11 @@ There are some macros to easily define options:
>  	Introduce an option with string argument.
>  	The string argument is put into `str_var`.
>  
> +`OPT_STRING_LIST(short, long, &list, arg_str, description)`::
> +	Introduce an option with string argument.
> +	The string argument is stored as an element in `&list` which must be a
> +	struct string_list. Reset the list using `--no-option`.
> +

I do not know if it is clear enough that 'option' in the last sentence is a placeholder. I then wondered if spelling it as `--no-<long>` would make it a bit clearer, but that is ugly.

The "Reset the list" is an instruction to the end-users who interact with a program written by readers of this document using OPT_STRING_LIST(), and it feels a bit out of place. Perhaps

	End users can reset the list by negating the option,
	i.e. passing "--no-<long>", on the command line.
I dunno.
Anyway, thanks for adding a missing doc here.
>  `OPT_INTEGER(short, long, &int_var, description)`::
>  	Introduce an option with integer argument.
>  	The integer is put into `int_var`.
Previous: Jacob KellerNext: Philip Oakley
Message 15 of 22 in “extend git-describe pattern matching”
  1. 0/5 extend git-describe pattern matchingJacob Keller, Jan 18, 2017
  2. 4/5 describe: teach --match to accept multiple patternsJacob Keller, Jan 18, 2017
  3. 5/5 describe: teach describe negative pattern matchesJacob Keller, Jan 18, 2017
  4. Junio C HamanoJan 18, 2017
  5. 3/5 name-rev: add support to exclude refs by pattern matchJacob Keller, Jan 18, 2017
  6. Junio C HamanoJan 18, 2017
  7. Jacob KellerJan 18, 2017
  8. Junio C HamanoJan 18, 2017
  9. Jacob KellerJan 18, 2017
  10. 2/5 name-rev: extend --refs to accept multiple patternsJacob Keller, Jan 18, 2017
  11. Junio C HamanoJan 18, 2017
  12. Jacob KellerJan 18, 2017
  13. Junio C HamanoJan 18, 2017
  14. 1/5 doc: add documentation for OPT_STRING_LISTJacob Keller, Jan 18, 2017
  15. Junio C HamanoJan 18, 2017
  16. Philip OakleyJan 18, 2017
  17. Junio C HamanoJan 18, 2017
  18. Johannes SchindelinJan 19, 2017
  19. Jacob KellerJan 18, 2017
  20. Junio C HamanoJan 19, 2017
  21. Junio C HamanoJan 18, 2017
  22. Jacob KellerJan 18, 2017

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.