bisect--helper: add "--next-exit" to output bisect results
[git/dscho.git] / builtin-bisect--helper.c
blobcb86a9a9e0cacbc64e1af8866b62d8f29dbc1776
1 #include "builtin.h"
2 #include "cache.h"
3 #include "parse-options.h"
4 #include "bisect.h"
6 static const char * const git_bisect_helper_usage[] = {
7 "git bisect--helper --next-vars",
8 "git bisect--helper --next-exit",
9 NULL
12 int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
14 int next_vars = 0;
15 int next_exit = 0;
16 struct option options[] = {
17 OPT_BOOLEAN(0, "next-vars", &next_vars,
18 "output next bisect step variables"),
19 OPT_BOOLEAN(0, "next-exit", &next_exit,
20 "output bisect result and exit instuctions"),
21 OPT_END()
24 argc = parse_options(argc, argv, options, git_bisect_helper_usage, 0);
26 if ((next_vars && next_exit) || (!next_vars && !next_exit))
27 usage_with_options(git_bisect_helper_usage, options);
29 if (next_vars)
30 return bisect_next_vars(prefix);
31 else /* next-exit */
32 return bisect_next_exit(prefix);