about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiQuery.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-03-23 21:45:45 +0000
committerEric Wong <e@80x24.org>2023-03-25 21:03:53 +0000
commit2dd3cec8783700f061a0c9b69e329918a4f5cccd (patch)
tree14eb91e32413f0006706ca0557309b4a37ff6139 /lib/PublicInbox/LeiQuery.pm
parent2021c73236b0c7d9f4e6ad90291c35138c9ef75e (diff)
downloadpublic-inbox-2dd3cec8783700f061a0c9b69e329918a4f5cccd.tar.gz
This fixes completions of labels (`+L:' for `lei import' and
`L:' for `lei q') so they can appear anywhere in the
command-line.

I mainly wanted this for `lei import $URL +L:label', but
this also fixes `lei forget-external' completions for URLs
(which involve colons).
Diffstat (limited to 'lib/PublicInbox/LeiQuery.pm')
-rw-r--r--lib/PublicInbox/LeiQuery.pm2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index 358574ea..3337e5d4 100644
--- a/lib/PublicInbox/LeiQuery.pm
+++ b/lib/PublicInbox/LeiQuery.pm
@@ -173,6 +173,8 @@ no query allowed on command-line with --stdin
 # shell completion helper called by lei__complete
 sub _complete_q {
         my ($self, @argv) = @_;
+        join('', @argv) =~ /\bL:\S*\z/ and
+                return eval { $self->_lei_store->search->all_terms('L') };
         my @cur;
         my $cb = $self->lazy_cb(qw(forget-external _complete_));
         while (@argv) {