Re: [PATCH v6 43/44] builtin/apply: add a cli option for be_silent
- From
René Scharfe <l.s.r@web.de>
- Date
- Jun 10, 2016, 20:59 UTC
- Message-ID
- <575B2A2E.3000403@web.de>
- In-Reply-To
- <20160610201118.13813-44-chriscool@tuxfamily.org>
Am 10.06.2016 um 22:11 schrieb Christian Couder:
Show 21 quoted lines
> Let's make it possible to request a silent operation on the
> command line.
>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
> builtin/apply.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/builtin/apply.c b/builtin/apply.c
> index ddd61de..93744f8 100644
> --- a/builtin/apply.c
> +++ b/builtin/apply.c
> @@ -74,6 +74,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix)
> OPT_BOOL(0, "allow-overlap", &state.allow_overlap,
> N_("allow overlapping hunks")),
> OPT__VERBOSE(&state.apply_verbosely, N_("be verbose")),
> + OPT_BOOL(0, "silent", &state.be_silent,
> + N_("do not print any output")),
> OPT_BIT(0, "inaccurate-eof", &options,
> N_("tolerate incorrectly detected missing new-line at the end of file"),
> APPLY_OPT_INACCURATE_EOF),Why not -q/--quiet as for most other commands?
Furthermore, you could use OPT__VERBOSITY, which causes -v and -q to update the same variable variable and thus lets parseopt handle their interaction. Perhaps verbosity == 1 could mean verbose, 0 normal, -1 no infos, -2 no warnings and -3 no errors?
And if you add the ability to silence the apply functions before using them you don't have to export and unexport dup_devnull().
René