Re: [PATCH v5 2/5] stash: convert apply to builtin
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Apr 5, 2018, 08:13 UTC
- Message-ID
- <CAP8UFD1zEu1kbKWiYKxYdkrVL4m5XmCMbqz47r+JNQjD2_MEwQ@mail.gmail.com>
- In-Reply-To
- <CAP8UFD0yz3yH7-fpxr=69z=wXAVjxraFWsuDVa7Ke_6ByV5B8Q@mail.gmail.com>
On Thu, Apr 5, 2018 at 9:59 AM, Christian Couder <christian.couder@gmail.com> wrote:
Show 18 quoted lines
> On Thu, Apr 5, 2018 at 9:50 AM, Christian Couder
> <christian.couder@gmail.com> wrote:
>>
>> So maybe we can get rid of `result` and have something like:
>>
>> if (argc < 1) {
>> error(_("at least one argument is required"));
>> usage_with_options(git_stash_helper_usage, options);
>
> Maybe we could also simplify these 2 lines by using usage_msg_opt().
>
>> }
>>
>> if (!strcmp(argv[0], "apply"))
>> return apply_stash(argc, argv, prefix);
>>
>> error(_("unknown subcommand: %s"), argv[0]);
>> usage_with_options(git_stash_helper_usage, options);And here actually we could improve the above 2 lines using something like:
usage_msg_opt(xstrfmt(_("unknown subcommand: %s"), argv[0]),
git_stash_helper_usage, options);It's better than using `error()` because the printed message will start with "fatal" instead of "error".