]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmdline-opts/gen.pl: generate nicer "See Also" in curl.1
authorDaniel Stenberg <daniel@haxx.se>
Tue, 1 Sep 2020 08:16:45 +0000 (10:16 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 1 Sep 2020 09:36:41 +0000 (11:36 +0200)
If there are more than two items in the list, use commas for all but the
last separator which is set to 'and'. Reads better.

Closes #5898

docs/cmdline-opts/gen.pl

index b7a924e8afa788ece5c21812beec0f799213a9a4..0c434dac99fb0beb788e3c0132d2f06b74040376 100755 (executable)
@@ -216,12 +216,24 @@ sub single {
     if($seealso) {
         my @m=split(/ /, $seealso);
         my $mstr;
+        my $and = 0;
+        my $num = scalar(@m);
+        if($num > 2) {
+            # use commas up to this point
+            $and = $num - 1;
+        }
+        my $i = 0;
         for my $k (@m) {
             if(!$helplong{$k}) {
                 print STDERR "WARN: $f see-alsos a non-existing option: $k\n";
             }
             my $l = manpageify($k);
-            $mstr .= sprintf "%s$l", $mstr?" and ":"";
+            my $sep = " and";
+            if($and && ($i < $and)) {
+                $sep = ",";
+            }
+            $mstr .= sprintf "%s$l", $mstr?"$sep ":"";
+            $i++;
         }
         push @foot, seealso($standalone, $mstr);
     }