aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2025-10-01 21:20:20 +0100
committerPádraig Brady <P@draigBrady.com>2025-10-02 10:14:16 +0100
commit58ea3574e67dee147a4305c0dda99c80f4b9d10c (patch)
treea5cbadc3c2347dd8cb498ff479f8cec21cef6a1c
parentdoc: man: consistently italicize --option parameters (diff)
downloadcoreutils-58ea3574e67dee147a4305c0dda99c80f4b9d10c.tar.gz
coreutils-58ea3574e67dee147a4305c0dda99c80f4b9d10c.zip
doc: man: consistently format -X[OPTIONAL] form
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).
-rwxr-xr-xman/help2man4
1 files changed, 3 insertions, 1 deletions
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/;