diff options
Diffstat (limited to 'hack/xref-helpmsgs-manpages')
-rwxr-xr-x | hack/xref-helpmsgs-manpages | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/hack/xref-helpmsgs-manpages b/hack/xref-helpmsgs-manpages index 08e56c77e..25e972fbc 100755 --- a/hack/xref-helpmsgs-manpages +++ b/hack/xref-helpmsgs-manpages @@ -320,7 +320,7 @@ sub podman_man { } } - # Options should always be of the form '**-f**' or '**--flag**', + # Options should always be of the form '**-f**' or '**\-\-flag**', # possibly separated by comma-space. elsif ($section eq 'flags') { # e.g. 'podman run --ip6', documented in man page, but nonexistent @@ -331,12 +331,23 @@ sub podman_man { @most_recent_flags = (); # As of PR #8292, all options are <h4> and anchored if ($line =~ s/^\#{4}\s+//) { + # 2021-03: PR #9856: some (bleep) markdown processor converts + # double dashes to a single em-dash. We need to escape every + # instance with backslashes. This is anti-intuitive, and + # developers will naturally write --foo; try to catch that + # and warn with a helpful message. + if ($line =~ /--([a-z]+)/) { + warn "$ME: $subpath:$.: You probably need to backslash-escape '--$1' as '\\-\\-$1'\n"; + } + # If option has long and short form, long must come first. # This is a while-loop because there may be multiple long # option names, e.g. --net/--network - while ($line =~ s/^\*\*(--[a-z0-9-]+)\*\*(=\*[a-zA-Z0-9-]+\*)?(,\s+)?//g) { - $man{$1} = 1; - push @most_recent_flags, $1; + while ($line =~ s/^\*\*\\-\\-([a-z0-9-]+)\*\*(=\*[a-zA-Z0-9-]+\*)?(,\s+)?//g) { + # add -- to the flag name + my $flag = "--".$1; + $man{$flag} = 1; + push @most_recent_flags, $flag; } # Short form if ($line =~ s/^\*\*(-[a-zA-Z0-9])\*\*(=\*[a-zA-Z0-9-]+\*)?//g) { |