MCPcopy Index your code
hub / github.com/git/git / parse_subcommand__cmd

Function parse_subcommand__cmd

t/helper/test-parse-options.c:339–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339static int parse_subcommand__cmd(int argc, const char **argv,
340 enum parse_opt_flags test_flags)
341{
342 const char *usage[] = {
343 "<...> cmd subcmd-one",
344 "<...> cmd subcmd-two",
345 NULL
346 };
347 parse_opt_subcommand_fn *fn = NULL;
348 int opt = 0;
349 struct option options[] = {
350 OPT_SUBCOMMAND("subcmd-one", &fn, subcmd_one),
351 OPT_SUBCOMMAND("subcmd-two", &fn, subcmd_two),
352 OPT_INTEGER('o', "opt", &opt, "an integer option"),
353 OPT_END()
354 };
355
356 if (test_flags & PARSE_OPT_SUBCOMMAND_OPTIONAL)
357 fn = subcmd_one;
358 argc = parse_options(argc, argv, NULL, options, usage, test_flags);
359
360 printf("opt: %d\n", opt);
361
362 return fn(argc, argv, NULL, NULL);
363}
364
365int cmd__parse_subcommand(int argc, const char **argv)
366{

Callers 1

cmd__parse_subcommandFunction · 0.85

Calls 1

parse_optionsFunction · 0.85

Tested by

no test coverage detected