]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiHelp.pm
imap+nntp: share COMPRESS implementation
[public-inbox.git] / lib / PublicInbox / LeiHelp.pm
index e62298f7d8176b9595235c479174ce6db1d5a6d5..fa0e78667b3b051cdf3dda96d0b8fba24e1f19f2 100644 (file)
@@ -20,7 +20,7 @@ sub call {
        my @opt_desc;
        my $lpad = 2;
        for my $sw (grep { !ref } @info) { # ("prio=s", "z", $GLP_PASS)
-               my $desc = $OPTDESC->{"$cmd\t$sw"} // $OPTDESC->{$sw} // next;
+               my $desc = $OPTDESC->{"$sw\t$cmd"} // $OPTDESC->{$sw} // next;
                my $arg_vals = '';
                ($arg_vals, $desc) = @$desc if ref($desc) eq 'ARRAY';
 
@@ -40,7 +40,7 @@ sub call {
                        @vals = (' [', undef, ']');
                } elsif ($x =~ s/=.+//) { # required arg: $x = "type=s"
                        @vals = (' ', undef);
-               } # else: no args $x = 'thread|t'
+               } # else: no args $x = 'threads|t'
 
                # we support underscore options from public-inbox-* commands;
                # but they've never been documented and will likely go away.
@@ -48,8 +48,8 @@ sub call {
                for (grep { !/_/ && !$NOHELP{$_} } split(/\|/, $x)) {
                        length($_) > 1 ? push(@l, "--$_") : push(@s, "-$_");
                }
-               if (!scalar(@vals)) { # no args 'thread|t'
-               } elsif ($arg_vals =~ s/\A([A-Z_]+)\b//) { # "NAME"
+               if (!scalar(@vals)) { # no args 'threads|t'
+               } elsif ($arg_vals =~ s/\A([A-Z_=]+)\b//) { # "NAME"
                        $vals[1] = $1;
                } else {
                        $vals[1] = uc(substr($l[0], 2)); # "--type" => "TYPE"
@@ -97,4 +97,7 @@ EOF
        undef;
 }
 
+# the "lei help" command
+sub lei_help { $_[0]->_help }
+
 1;