Skip to content

Commit 9e1c84d

Browse files
pranitbauva1997gitster
authored andcommitted
bisect--helper: use OPT_CMDMODE instead of OPT_BOOL
`--next-all` is meant to be used as a subcommand to support multiple "operation mode" though the current implementation does not contain any other subcommand along side with `--next-all` but further commits will include some more subcommands. Helped-by: Johannes Schindelin <[email protected]> Mentored-by: Lars Schneider <[email protected]> Mentored-by: Christian Couder <[email protected]> Signed-off-by: Pranit Bauva <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 217f276 commit 9e1c84d

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

builtin/bisect--helper.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ static const char * const git_bisect_helper_usage[] = {
1010

1111
int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
1212
{
13-
int next_all = 0;
13+
enum { NEXT_ALL = 1 } cmdmode = 0;
1414
int no_checkout = 0;
1515
struct option options[] = {
16-
OPT_BOOL(0, "next-all", &next_all,
17-
N_("perform 'git bisect next'")),
16+
OPT_CMDMODE(0, "next-all", &cmdmode,
17+
N_("perform 'git bisect next'"), NEXT_ALL),
1818
OPT_BOOL(0, "no-checkout", &no_checkout,
1919
N_("update BISECT_HEAD instead of checking out the current commit")),
2020
OPT_END()
@@ -23,9 +23,14 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
2323
argc = parse_options(argc, argv, prefix, options,
2424
git_bisect_helper_usage, 0);
2525

26-
if (!next_all)
26+
if (!cmdmode)
2727
usage_with_options(git_bisect_helper_usage, options);
2828

29-
/* next-all */
30-
return bisect_next_all(prefix, no_checkout);
29+
switch (cmdmode) {
30+
case NEXT_ALL:
31+
return bisect_next_all(prefix, no_checkout);
32+
default:
33+
return error("BUG: unknown subcommand '%d'", cmdmode);
34+
}
35+
return 0;
3136
}

0 commit comments

Comments
 (0)