In the Coreutils man pages we have occurrences of:
--option=[+]count
to indicate an optional '+' sign in the given number. The help2man
script generates poor output for these. This can be seen on the tail man
pages [1]. Here is the generated HTML:
<b>-c</b>, <b>--bytes</b>=<i>[</i>+]NUM
Specifically, the italic tag makes the '[' appear strange. However, the
case for:
--option=[-]count
looks much better. We can see this in the head man page [2]:
<b>-c</b>, <b>--bytes</b>=<i>[-]NUM</i>
The attached patch fixes it. WDYT?
I tagged [email protected], but I am not sure if it even exists
because I cannot find an archive. And AFAIK it is not version
controlled, only distributed through ftp.gnu.org.
Collin
[1] https://man7.org/linux/man-pages/man1/tail.1.html
[2] https://man7.org/linux/man-pages/man1/head.1.html
>From 49a3697d1fbd08f3ec826b074982dd01965f5b71 Mon Sep 17 00:00:00 2001
Message-ID: <49a3697d1fbd08f3ec826b074982dd01965f5b71.1753575177.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sat, 26 Jul 2025 17:10:01 -0700
Subject: [PATCH] doc: emit better output for --option=[+]count in man pages
* man/help2man: Check for the '+' character like we do for '-'.
---
man/help2man | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/help2man b/man/help2man
index 960eebcae..217b0e008 100755
--- a/man/help2man
+++ b/man/help2man
@@ -600,7 +600,7 @@ while (length)
unless ($sect eq _('EXAMPLES'))
{
# Convert options.
- s/(^|[ (])(-[][\w=-]+)/$1 . convert_option $2/mge;
+ s/(^|[ (])(-[][\w=\+-]+)/$1 . convert_option $2/mge;
# Italicise filenames: /a/b, $VAR/c/d, ~/e/f
s!
--
2.50.1