managen: cleanups to generate nicer-looking output

- output "see also" last
- when there are multiple mutex items, use commas between all of them
  except the last.
- call them mututally exclusive WITH not TO other options.
- remove trailing space from added in, add newline prefix
- smoother language for requires

Closes #14001
This commit is contained in:
Daniel Stenberg 2024-06-24 10:53:29 +02:00
parent 76e0196b1e
commit 1c9250c46d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -203,7 +203,7 @@ sub seealso {
".SH \"SEE ALSO\"\n$data\n"; ".SH \"SEE ALSO\"\n$data\n";
} }
else { else {
return "See also $data. "; return "\nSee also $data. ";
} }
} }
@ -255,7 +255,7 @@ sub added {
return ".SH \"ADDED\"\nAdded in curl version $data\n"; return ".SH \"ADDED\"\nAdded in curl version $data\n";
} }
else { else {
return "Added in $data. "; return "\nAdded in $data.";
} }
} }
@ -710,25 +710,31 @@ sub single {
$mstr .= sprintf "%s$l", $mstr?"$sep ":""; $mstr .= sprintf "%s$l", $mstr?"$sep ":"";
$i++; $i++;
} }
push @foot, seealso($standalone, $mstr);
if($requires) { if($requires) {
my $l = $manpage ? manpageify($long) : "--$long"; my $l = $manpage ? manpageify($long) : "--$long";
push @foot, "$l requires that the underlying libcurl". push @foot, "$l requires that libcurl".
" was built to support $requires. "; " is built to support $requires.\n";
} }
if($mutexed) { if($mutexed) {
my @m=split(/ /, $mutexed); my @m=split(/ /, $mutexed);
my $mstr; my $mstr;
my $num = scalar(@m);
my $count;
for my $k (@m) { for my $k (@m) {
if(!$helplong{$k}) { if(!$helplong{$k}) {
print STDERR "WARN: $f mutexes a non-existing option: $k\n"; print STDERR "WARN: $f mutexes a non-existing option: $k\n";
} }
my $l = $manpage ? manpageify($k) : "--$k"; my $l = $manpage ? manpageify($k) : "--$k";
$mstr .= sprintf "%s$l", $mstr?" and ":""; my $sep = ", ";
if($count == ($num -1)) {
$sep = " and ";
}
$mstr .= sprintf "%s$l", $mstr?$sep:"";
$count++;
} }
push @foot, overrides($standalone, push @foot, overrides($standalone,
"This option is mutually exclusive to $mstr. "); "This option is mutually exclusive with $mstr.\n");
} }
if($examples[0]) { if($examples[0]) {
my $s =""; my $s ="";
@ -757,6 +763,7 @@ sub single {
if($added) { if($added) {
push @foot, added($standalone, $added); push @foot, added($standalone, $added);
} }
push @foot, seealso($standalone, $mstr);
if($foot[0]) { if($foot[0]) {
print "\n"; print "\n";
my $f = join("", @foot); my $f = join("", @foot);