Re: [PATCH 1/2] completion: take into account the formatting backticks for options
- From
Jean-Noël AVILA <jn.avila@free.fr>
- Date
- Mar 18, 2025, 03:58 UTC
- Message-ID
- <2773494.mvXUDI8C0e@cayenne>
- In-Reply-To
- <xmqqplif8jnm.fsf@gitster.g>
On Monday, 17 March 2025 21:52:13 CET Junio C Hamano wrote:
> "Jean-Noël Avila via GitGitGadget" <gitgitgadget@gmail.com> writes: > > From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr> > > > > With the modern formatting of the manpages, the options and commands are
now
Show 21 quoted lines
> > backticked in their definition lists. This patch updates the generation of
> > the completion list to take into account this new format.
> >
> > Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
> > ---
> >
> > generate-configlist.sh | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/generate-configlist.sh b/generate-configlist.sh
> > index dffdaada8b5..802178daad4 100755
> > --- a/generate-configlist.sh
> > +++ b/generate-configlist.sh
> > @@ -13,8 +13,8 @@ print_config_list () {
> >
> > cat <<EOF
> >
> > static const char *config_name_list[] = {
> > EOF
> >
> > - grep -h '^[a-zA-Z].*\..*::$' "$SOURCE_DIR"/Documentation/*config.adoc
Show 25 quoted lines
> > "$SOURCE_DIR"/Documentation/config/*.adoc | - sed '/deprecated/d; s/::$//;
> > s/, */\n/g' |
> > + grep -h '^`\?[a-zA-Z].*\..*`\?::$'
> > "$SOURCE_DIR"/Documentation/*config.adoc
> > "$SOURCE_DIR"/Documentation/config/*.adoc |
> Using \? in BRE as a short-hand for \{0,1\} (or trying to use any
> single regexp magic in BRE by adding a backslash when that magic is
> only available in ERE) is a GNUism, isn't it?
>
> We probably should rewrite the thing as ERE, perhaps like
>
> grep -E -h '^`?[a-zA-Z].*\..*`?::$' ...
>
> Also, if we can avoid piping grep into sed or awk, we should do so,
> when it does not lose readability. Perhaps we can do something like
>
> sed -E -n -e '/... that pattern .../{
> /deprecated/d;
> s/::$//;
> ...
> }' "$SOURCE_DIR"/Documentation/*config.adoc ... |
> sort |
> ...
>
> in this case?For the GNUism, the tests on MacOS and Windows by gitgitgadget passed. But I get your point and will reroll.