diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-09-01 10:16:45 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-09-01 10:16:45 +0200 |
commit | 4546a71b9fd904ba9c1ca3cc9ac470c8cf813c75 (patch) | |
tree | fef053e691983ec3ffac2f7086a0c4983ac866ec | |
parent | 82149e70a505ca43c606836fac023a750510d71d (diff) | |
download | curl-bagder/manpage-nicer-seealso.tar.gz |
cmdline-opts/gen.pl: generate nicer "See Also"bagder/manpage-nicer-seealso
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.
-rwxr-xr-x | docs/cmdline-opts/gen.pl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/cmdline-opts/gen.pl b/docs/cmdline-opts/gen.pl index b7a924e8a..0c434dac9 100755 --- a/docs/cmdline-opts/gen.pl +++ b/docs/cmdline-opts/gen.pl @@ -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); } |