bisect--helper: use OPT_CMDMODE instead of OPT_BOOL
[git] / builtin / bisect--helper.c
1 #include "builtin.h"
2 #include "cache.h"
3 #include "parse-options.h"
4 #include "bisect.h"
5
6 static const char * const git_bisect_helper_usage[] = {
7         N_("git bisect--helper --next-all [--no-checkout]"),
8         NULL
9 };
10
11 int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
12 {
13         enum { NEXT_ALL = 1 } cmdmode = 0;
14         int no_checkout = 0;
15         struct option options[] = {
16                 OPT_CMDMODE(0, "next-all", &cmdmode,
17                          N_("perform 'git bisect next'"), NEXT_ALL),
18                 OPT_BOOL(0, "no-checkout", &no_checkout,
19                          N_("update BISECT_HEAD instead of checking out the current commit")),
20                 OPT_END()
21         };
22
23         argc = parse_options(argc, argv, prefix, options,
24                              git_bisect_helper_usage, 0);
25
26         if (!cmdmode)
27                 usage_with_options(git_bisect_helper_usage, options);
28
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;
36 }