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

Re: [PATCH v3 1/3] bundle: framework for options before bundle file

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 11, 2019, 02:34 UTC
Message-ID
<xmqqlfsni1jh.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191110204126.30553-1-robbat2@gentoo.org>
"Robin H. Johnson" <robbat2@gentoo.org> writes:
Show 16 quoted lines
> +static int verbose;
> +
> +static int parse_options_cmd_bundle(int argc,
> +		const char **argv,
> +		const char* prefix,
> +		const char * const usagestr[],
> +		const struct option options[],
> +		const char **bundle_file) {
> +	int newargc;
> +	newargc = parse_options(argc, argv, NULL, options, usagestr,
> +			     PARSE_OPT_STOP_AT_NON_OPTION);
> +	if (argc < 1)
> +		usage_with_options(usagestr, options);
> +	*bundle_file = prefix_filename(prefix, argv[0]);
> +	return newargc;
> +}
Looks like a useful helper to be shared among subcommands.
Show 16 quoted lines
> +static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
> +	struct option options[] = {
> +		OPT_END()
> +	};
> +	const char* bundle_file;
> ...
> +int cmd_bundle(int argc, const char **argv, const char *prefix)
> +{
> +	struct option options[] = {
> +		OPT__VERBOSE(&verbose, N_("be verbose; must be placed before a subcommand")),
> +		OPT_END()
> +	};
> +	int result;
> +
> +	argc = parse_options(argc, argv, prefix, options, builtin_bundle_usage,
> +		PARSE_OPT_STOP_AT_NON_OPTION);
Looks like a reasonable arrangement for two-level option parser.
Previous: Junio C HamanoNext: Jeff King
Message 9 of 13 in “bundle: framework for options before bundle file”
  1. 1/3 bundle: framework for options before bundle fileRobin H. Johnson, Nov 10, 2019
  2. 3/3 bundle-verify: add --quietRobin H. Johnson, Nov 10, 2019
  3. Jeff KingNov 11, 2019
  4. 2/3 bundle-create: progress output controlRobin H. Johnson, Nov 10, 2019
  5. Jeff KingNov 11, 2019
  6. Robin H. JohnsonNov 11, 2019
  7. Jeff KingNov 11, 2019
  8. Junio C HamanoNov 11, 2019
  9. Junio C HamanoNov 11, 2019
  10. Jeff KingNov 11, 2019
  11. Johannes SchindelinNov 11, 2019
  12. Junio C HamanoNov 11, 2019
  13. Johannes SchindelinNov 12, 2019

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.