about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-06 12:18:30 +0000
committerEric Wong <e@80x24.org>2021-02-07 03:34:32 +0000
commit5b659949bdb3991024c7821ee06c93e3c4877dbe (patch)
treedcc19cbcb1b3ceed35ad11d50ae77fbcfb2e6c6a /lib
parent618c5d7767a3611d70f78825156d5ddac7ce9427 (diff)
downloadpublic-inbox-5b659949bdb3991024c7821ee06c93e3c4877dbe.tar.gz
We did not complete --no-* flags properly when multiple options
are allowed.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/LEI.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index b058b533..8d5a921e 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -274,6 +274,8 @@ my %OPTDESC = (
 'by-mid|mid:s' => [ 'MID', 'match only by Message-ID, ignoring contents' ],
 'jobs:i' => 'set parallelism level',
 
+'kw|keywords|flags!' => 'disable/enable importing flags',
+
 # xargs, env, use "-0", git(1) uses "-z".  We support z|0 everywhere
 'z|0' => 'use NUL \\0 instead of newline (CR) to delimit lines',
 
@@ -425,7 +427,7 @@ sub _help ($;$) {
                 my (@vals, @s, @l);
                 my $x = $sw;
                 if ($x =~ s/!\z//) { # solve! => --no-solve
-                        $x = "no-$x";
+                        $x =~ s/(\A|\|)/$1no-/g
                 } elsif ($x =~ s/:.+//) { # optional args: $x = "mid:s"
                         @vals = (' [', undef, ']');
                 } elsif ($x =~ s/=.+//) { # required arg: $x = "type=s"
@@ -710,8 +712,9 @@ sub lei__complete {
                 }
                 puts $self, grep(/$re/, map { # generate short/long names
                         if (s/[:=].+\z//) { # req/optional args, e.g output|o=i
-                        } else { # negation: solve! => no-solve|solve
-                                s/\A(.+)!\z/no-$1|$1/;
+                        } elsif (s/!\z//) {
+                                # negation: solve! => no-solve|solve
+                                s/([\w\-]+)/$1|no-$1/g
                         }
                         map {
                                 my $x = length > 1 ? "--$_" : "-$_";