Attached are two patches to make option formatting more consistent.
The first ensures more --option=... variations are supported, i.e. italicized.
The second ensures -X[OPTIONAL] only formats the -X as bold,
and puts the "OPTIONAL" in italics, rather than having it all bold.
The first patch addresses the formatting issue reported at:
https://github.com/coreutils/coreutils/issues/84
thanks,
Padraig
From 596b137a7c89f1d602cf7ccc3afb332da1f76e16 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Wed, 1 Oct 2025 18:38:21 +0100
Subject: [PATCH 1/2] doc: italicize --option parameters consistently in man
pages
This changes a few pages, but the changes in tail.1
concisely illustrate the resulting man page changes:
$ diff -r man.orig/tail.1 man/tail.1
< \fB\-c\fR, \fB\-\-bytes\fR=\fI\,[\/\fR+]NUM
> \fB\-c\fR, \fB\-\-bytes\fR=\fI\,[+]NUM\/\fR
< \fB\-f\fR, \fB\-\-follow[=\fR{name|descriptor}]
> \fB\-f\fR, \fB\-\-follow\fR[=\fI\,{name|descriptor}\/\fR]
< \fB\-n\fR, \fB\-\-lines\fR=\fI\,[\/\fR+]NUM
> \fB\-n\fR, \fB\-\-lines\fR=\fI\,[+]NUM\/\fR
* man/help2man: Relax the option match so more --option
variations are supported, and passed through to convert_option().
Specifically more variations after '=' are now supported.
Also split and document the regular expression.
Reported at https://github.com/coreutils/coreutils/issues/84
---
man/help2man | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/man/help2man b/man/help2man
index 960eebcae..da03e14da 100755
--- a/man/help2man
+++ b/man/help2man
@@ -600,7 +600,12 @@ while (length)
unless ($sect eq _('EXAMPLES'))
{
# Convert options.
- s/(^|[ (])(-[][\w=-]+)/$1 . convert_option $2/mge;
+ s/
+ (
+ ^|[ (])(-[][\w-]+ # Base -o or --option match
+ (?:=\S*[^\s,.])? # =parameter portion match
+ )
+ /$1 . convert_option $2/xmge;
# Italicise filenames: /a/b, $VAR/c/d, ~/e/f
s!
--
2.51.0
From 6b6d4a05a15b9c3b24bd0a74d72757ef5bae0b84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Wed, 1 Oct 2025 21:20:20 +0100
Subject: [PATCH 2/2] doc: help2man: consistently format short form optional
parameters
This is significant for the date, od, and pr commands
which have options of the form -X[OPTIONAL], which change like:
diff -r man.orig/date.1 man/date.1
< \fB\-I[FMT]\fR, \fB\-\-iso\-8601\fR[=\fI\,FMT\/\fR]
> \fB\-I\fR[\fI\,FMT\/\fR], \fB\-\-iso\-8601\fR[=\fI\,FMT\/\fR]
diff -r man.orig/od.1 man/od.1
< \fB\-w[BYTES]\fR, \fB\-\-width\fR[=\fI\,BYTES\/\fR]
> \fB\-w\fR[\fI\,BYTES\/\fR], \fB\-\-width\fR[=\fI\,BYTES\/\fR]
* man/help2man (convert_options): Support options of the form
-X[PARAM], so that we now consistently format them (in italics).
---
man/help2man | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/man/help2man b/man/help2man
index da03e14da..e021ff8dc 100755
--- a/man/help2man
+++ b/man/help2man
@@ -803,7 +803,9 @@ sub convert_option
local $_ = '\fB' . shift;
s/-/\x83/g;
- unless (s/\[=(.*)\]$/\\fR[=\\fI$1\\fR]/)
+ unless (
+ s/\x83(\w)\[(.*)\]/\x83$1\\fR[\\fI$2\\fR]/ or # short form [optional]
+ s/\[=(.*)\]$/\\fR[=\\fI$1\\fR]/) # long form [optional]
{
s/=(.)/\\fR=\\fI$1/;
s/ (.)/ \\fI$1/;
--
2.51.0