mirror of
https://github.com/curl/curl.git
synced 2026-05-18 00:16:20 +03:00
cmdline-opts/gen.pl: fix the linkifier
Improved logic for finding existing --options in text and replacing with the full version with nroff syntax. This also makes the web version link options better. Reported-by: xianghongai on github Fixes #9899 Closes #9902
This commit is contained in:
parent
184fc6f07a
commit
4154165e5e
1 changed files with 17 additions and 6 deletions
|
|
@ -104,9 +104,15 @@ sub printdesc {
|
|||
}
|
||||
# skip lines starting with space (examples)
|
||||
if($d =~ /^[^ ]/ && $d =~ /--/) {
|
||||
for my $k (keys %optlong) {
|
||||
# scan for options in longest-names first order
|
||||
for my $k (sort {length($b) <=> length($a)} keys %optlong) {
|
||||
# --tlsv1 is complicated since --tlsv1.2 etc are also
|
||||
# acceptable options!
|
||||
if(($k eq "tlsv1") && ($d =~ /--tlsv1\.[0-9]\\f/)) {
|
||||
next;
|
||||
}
|
||||
my $l = manpageify($k);
|
||||
$d =~ s/--\Q$k\E([^a-z0-9_-])([^a-zA-Z0-9_])/$l$1$2/;
|
||||
$d =~ s/\-\-$k([^a-z0-9-])/$l$1/g;
|
||||
}
|
||||
}
|
||||
# quote "bare" minuses in the output
|
||||
|
|
@ -345,12 +351,13 @@ sub single {
|
|||
printdesc(@desc);
|
||||
undef @desc;
|
||||
|
||||
my @extra;
|
||||
if($multi eq "single") {
|
||||
print "\nIf --$long is provided several times, the last set ".
|
||||
push @extra, "\nIf --$long is provided several times, the last set ".
|
||||
"value will be used.\n";
|
||||
}
|
||||
elsif($multi eq "append") {
|
||||
print "\n--$long can be used several times in a command line\n";
|
||||
push @extra, "\n--$long can be used several times in a command line\n";
|
||||
}
|
||||
elsif($multi eq "boolean") {
|
||||
my $rev = "no-$long";
|
||||
|
|
@ -360,13 +367,17 @@ sub single {
|
|||
$rev = $long;
|
||||
$rev =~ s/^no-//;
|
||||
}
|
||||
print "\nProviding --$long multiple times has no extra effect.\n".
|
||||
push @extra,
|
||||
"\nProviding --$long multiple times has no extra effect.\n".
|
||||
"Disable it again with --$rev.\n";
|
||||
}
|
||||
elsif($multi eq "mutex") {
|
||||
print "\nProviding --$long multiple times has no extra effect.\n";
|
||||
push @extra,
|
||||
"\nProviding --$long multiple times has no extra effect.\n";
|
||||
}
|
||||
|
||||
printdesc(@extra);
|
||||
|
||||
my @foot;
|
||||
if($seealso) {
|
||||
my @m=split(/ /, $seealso);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue