]> Kevux Git Server - rit/commitdiff
completion: take into account the formatting backticks for options
authorJean-Noël Avila <jn.avila@free.fr>
Wed, 19 Mar 2025 08:16:22 +0000 (08:16 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Mar 2025 02:27:29 +0000 (19:27 -0700)
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.

The script `generate-configlist.sh` is updated to get rid of extraneous
commands and fit everything in a single sed script.

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
generate-configlist.sh

index dffdaad..b06da53 100755 (executable)
@@ -13,10 +13,18 @@ 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' |
-       sort |
-       sed 's/^.*$/    "&",/'
+       sed -E '
+/^`?[a-zA-Z].*\..*`?::$/ {
+       /deprecated/d;
+       s/::$//;
+       s/`//g;
+       s/^.*$/ "&",/;
+       s/,  */",\n     "/g;
+       p;};
+d' \
+           "$SOURCE_DIR"/Documentation/*config.adoc \
+           "$SOURCE_DIR"/Documentation/config/*.adoc|
+       sort
        cat <<EOF
        NULL,
 };