diff --git a/docs/cmdline-opts/_OPTIONS.md b/docs/cmdline-opts/_OPTIONS.md index 8f388130aa..106298e745 100644 --- a/docs/cmdline-opts/_OPTIONS.md +++ b/docs/cmdline-opts/_OPTIONS.md @@ -17,7 +17,7 @@ options *-O*, *-L* and *-v* at once as *-OLv*. In general, all boolean options are enabled with --**option** and yet again disabled with --**no-**option. That is, you use the same option name but prefix it with `no-`. However, in this list we mostly only list and show the -*--option* version of them. +--**option** version of them. When --next is used, it resets the parser state and you start again with a clean option state, except for the options that are global. Global options diff --git a/docs/cmdline-opts/gen.pl b/docs/cmdline-opts/gen.pl index 9105529998..e7b621b2dc 100755 --- a/docs/cmdline-opts/gen.pl +++ b/docs/cmdline-opts/gen.pl @@ -72,16 +72,23 @@ close(INC); sub manpageify { my ($k)=@_; my $l; + my $trail; + # the matching pattern might include a trailing dot that cannot be part of + # the option name + if($k =~ s/\.$//) { + # cut off trailing dot + $trail = "."; + } my $klong = $k; # quote "bare" minuses in the long name $klong =~ s/-/\\-/g; - if($optlong{$k} ne "") { + if($optlong{$k}) { # both short + long - $l = "\\fI-".$optlong{$k}.", \\-\\-$klong\\fP"; + $l = "\\fI-".$optlong{$k}.", \\-\\-$klong\\fP$trail"; } else { # only long - $l = "\\fI\\-\\-$klong\\fP"; + $l = "\\fI\\-\\-$klong\\fP$trail"; } return $l; } @@ -289,16 +296,7 @@ sub render { $d =~ s/\\/\\\\/g; if(!$quote && $d =~ /--/) { - # 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/--$k([^a-z0-9-])/$l$1/g; - } + $d =~ s/--([a-z0-9.-]+)/manpageify($1)/ge; } # quote minuses in the output