git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: "René Scharfe" <l.s.r@web.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH] grep: use OPT_INTEGER_F for --max-depth
Date: Tue, 5 Sep 2023 03:21:22 -0400	[thread overview]
Message-ID: <20230905072122.GG199565@coredump.intra.peff.net> (raw)
In-Reply-To: <4d2eb736-4f34-18f8-2eb7-20e7f7b8c2f8@web.de>

On Sat, Sep 02, 2023 at 08:54:54PM +0200, René Scharfe wrote:

> a91f453f64 (grep: Add --max-depth option., 2009-07-22) added the option
> --max-depth, defining it using a positional struct option initializer of
> type OPTION_INTEGER.  It also sets defval to 1 for some reason, but that
> value would only be used if the flag PARSE_OPT_OPTARG was given.
> 
> Use the macro OPT_INTEGER_F instead to standardize the definition and
> specify only the necessary values.  This also normalizes argh to N_("n")
> as a side-effect, which is OK.

This looks correct to me (and an improvement in readability). In
general, I wonder how many of the results from:

  git grep '{ OPTION'

could be converted to use the macros and end up more readable. There are
a number of OPTARG ones, which I guess can't use macros. Looks like
there are a handful of others (mostly for OPT_HIDDEN).

-Peff

  reply	other threads:[~2023-09-05 16:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-02 18:54 [PATCH] grep: use OPT_INTEGER_F for --max-depth René Scharfe
2023-09-05  7:21 ` Jeff King [this message]
2023-09-07 20:20   ` René Scharfe
2023-09-07 20:40     ` Jeff King
2023-09-08 22:28       ` René Scharfe
2023-09-09 21:14         ` René Scharfe
2023-09-12  7:51         ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230905072122.GG199565@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=l.s.r@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).