1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

cmdline-opts/gen.pl: generate nicer "See Also" in curl.1

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
This commit is contained in:
Daniel Stenberg 2020-09-01 10:16:45 +02:00
parent 82149e70a5
commit 401d237b85
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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);
}