All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Jean-Noël Avila via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Jean-Noël Avila" <jn.avila@free.fr>
Subject: Re: [PATCH 1/2] completion: take into account the formatting backticks for options
Date: Mon, 17 Mar 2025 13:52:13 -0700	[thread overview]
Message-ID: <xmqqplif8jnm.fsf@gitster.g> (raw)
In-Reply-To: <f8883d83f3096ce16e5dfc9647a41970396693f4.1742056310.git.gitgitgadget@gmail.com> ("Jean-Noël Avila via GitGitGadget"'s message of "Sat, 15 Mar 2025 16:31:49 +0000")

"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
> 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 "$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?

> +	sed '/deprecated/d; s/::$//; s/`//g; s/,  */\n/g' |
>  	sort |
>  	sed 's/^.*$/	"&",/'
>  	cat <<EOF

  reply	other threads:[~2025-03-17 20:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-15 16:31 [PATCH 0/2] doc: apply new format to git-branch man page Jean-Noël Avila via GitGitGadget
2025-03-15 16:31 ` [PATCH 1/2] completion: take into account the formatting backticks for options Jean-Noël Avila via GitGitGadget
2025-03-17 20:52   ` Junio C Hamano [this message]
2025-03-18  3:58     ` Jean-Noël AVILA
2025-03-18  4:16       ` Junio C Hamano
2025-03-18  4:27         ` Jean-Noël AVILA
2025-03-15 16:31 ` [PATCH 2/2] doc: apply new format to git-branch man page Jean-Noël Avila via GitGitGadget
2025-03-17 21:34   ` Junio C Hamano
2025-03-19  8:16 ` [PATCH v2 0/2] " Jean-Noël Avila via GitGitGadget
2025-03-19  8:16   ` [PATCH v2 1/2] completion: take into account the formatting backticks for options Jean-Noël Avila via GitGitGadget
2025-03-19  8:16   ` [PATCH v2 2/2] doc: apply new format to git-branch man page Jean-Noël Avila via GitGitGadget

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=xmqqplif8jnm.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=jn.avila@free.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.