Hi Pranit,

On Wed, 4 May 2016, Pranit Bauva wrote:

> `--next-all` is meant to be used as a sub command to support multiple
> "operation mode" though the current implementation does not contain any
> other sub command along side with `--next-all` but further commits will
> include some more subcommands.

That is a good explanation.

> diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
> index 3324229..5f6ef8c 100644
> --- a/builtin/bisect--helper.c
> +++ b/builtin/bisect--helper.c
> @@ -8,13 +8,17 @@ static const char * const git_bisect_helper_usage[] = {
>       NULL
>  };
>  
> +enum sub_commands {

Instead of "sub_commands" and ...

> +     NEXT_ALL = 1
> +};
> +
>  int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
>  {
> -     int next_all = 0;
> +     int sub_command = 0;

... sub_command, seeing as you convert things into ...

>       int no_checkout = 0;
>       struct option options[] = {
> -             OPT_BOOL(0, "next-all", &next_all,
> -                      N_("perform 'git bisect next'")),
> +             OPT_CMDMODE(0, "next-all", &sub_command,
> +                      N_("perform 'git bisect next'"), NEXT_ALL),

... using CMDMODE, how about using `enum mode` and `int mode`? And
actually `enum mode mode` instead of `int mode`. Or...

Actually, it could be even more concise by writing

        enum { NEXT_ALL = 1 } mode = 0;

There is not really a need for that enum to be in a different scope than
cmd_bisect__helper(), and neither does it need to be named...

Ciao,
Dscho
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to