[PATCH 2/2] swapon: rename the new --annotation option to --annotate

Benno Schulenberg <[email protected]> Sun, 5 Oct 2025 15:20:48 +0200
Newsgroups org.kernel.vger.util-linux
Message-ID <[email protected]>
The form --annotation gave the impression that after the subsequent
"=" comes the text that each column name should be annotated with.
Furthermore, the other two options with optional arguments (--show
and --discard) are in the imperative, so follow that style and use
--annotate instead.

(In the bargain, this allows aligning the descriptions in the help
text perfectly again.)

Also, improve the description of --annotate in the man page somewhat.

CC: Christian Goeschel Ndjomouo <[email protected]>
Signed-off-by: Benno Schulenberg <[email protected]>
---
 bash-completion/swapon     | 2 +-
 lib/strutils.c             | 2 +-
 man-common/annotation.adoc | 8 ++++----
 sys-utils/swapon.c         | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/bash-completion/swapon b/bash-completion/swapon
index d94d2234d..5906ec844 100644
--- a/bash-completion/swapon
+++ b/bash-completion/swapon
@@ -56,7 +56,7 @@ _swapon_module()
 	case $cur in
 		-*)
 			OPTS="--all
-				--annotation
+				--annotate
 				--discard
 				--ifexists
 				--fixpgsz
diff --git a/lib/strutils.c b/lib/strutils.c
index e4dabf212..a3b1376e3 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -562,7 +562,7 @@ bool annotationwanted(const char *mode)
 	if (!mode || strcmp(mode, "auto") == 0)
 		return isatty(STDOUT_FILENO) ? true : false;
 
-	errx(EXIT_FAILURE, _("invalid argument of --annotation: %s"), mode);
+	errx(EXIT_FAILURE, _("invalid argument of --annotate: %s"), mode);
 }
 
 /*
diff --git a/man-common/annotation.adoc b/man-common/annotation.adoc
index 8f9d4c879..cbace162e 100644
--- a/man-common/annotation.adoc
+++ b/man-common/annotation.adoc
@@ -1,6 +1,6 @@
-*--annotation*[**=**_when_]::
-Adds an annotation to column header names which can be printed as a
-tooltip by supporting terminals. The optional _when_ argument can be
-*always*, *never*, or *auto*. If the argument is omitted, it defaults to
+*--annotate*[**=**_when_]::
+Adds an annotation to each column header name. Such an annotation can be shown
+as a tooltip by terminals that support this feature. The optional _when_ argument
+can be *always*, *never*, or *auto*. If the argument is omitted, it defaults to
 *auto*, which means that annotations will only be used when the output
 goes to a terminal.
diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c
index 896728880..fc5351e21 100644
--- a/sys-utils/swapon.c
+++ b/sys-utils/swapon.c
@@ -840,7 +840,7 @@ static void __attribute__((__noreturn__)) usage(void)
 	fputs(_(" -T, --fstab <path>       alternative file to /etc/fstab\n"), out);
 	fputs(_("     --show[=<columns>]   display summary in definable table\n"), out);
 	fputs(_("     --output-all         output all available columns\n"), out);
-	fputs(_("     --annotation[=<when>]  annotate columns with a tooltip (always|never|auto)\n"), out);
+	fputs(_("     --annotate[=<when>]  annotate columns with a tooltip (always|never|auto)\n"), out);
 	fputs(_("     --noheadings         don't print table heading (with --show)\n"), out);
 	fputs(_("     --raw                use the raw output format (with --show)\n"), out);
 	fputs(_("     --bytes              display swap size in bytes in --show output\n"), out);
@@ -900,7 +900,7 @@ int main(int argc, char *argv[])
 		{ "version",      no_argument,       NULL, 'V'                 },
 		{ "show",         optional_argument, NULL, SHOW_OPTION         },
 		{ "output-all",   no_argument,       NULL, OPT_LIST_TYPES      },
-		{ "annotation",   optional_argument, NULL, ANNOTATION_OPTION   },
+		{ "annotate",     optional_argument, NULL, ANNOTATION_OPTION   },
 		{ "noheadings",   no_argument,       NULL, NOHEADINGS_OPTION   },
 		{ "raw",          no_argument,       NULL, RAW_OPTION          },
 		{ "bytes",        no_argument,       NULL, BYTES_OPTION        },
-- 
2.51.0