Re: [PATCH v2 16/20] builtin/reflog.c: let parse-options parse subcommands
On Fri, Aug 19 2022, SZEDER Gábor wrote:
> + parse_opt_subcommand_fn *fn = NULL;
Re the comment on notes.c this is a bit like that pattern...
Show 8 quoted lines
> -log_reflog:
> - return cmd_log_reflog(argc, argv, prefix);
> + PARSE_OPT_KEEP_UNKNOWN_OPT);
> + if (fn)
> + return fn(argc - 1, argv + 1, prefix);
> + else
> + return cmd_log_reflog(argc, argv, prefix);
> }
Maybe more obvious (untested):
if (!fn) {
argc--;
argv++;
fn = cmd_log_reflog;
}
return fn(argc, argv, prefix);