about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiQuery.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-02-02 11:46:52 +0000
committerEric Wong <e@80x24.org>2021-02-03 07:32:37 +0000
commit35597221da323ec3471e58fba9f04aa6e3937737 (patch)
tree3a11cb55494d0e53772a5af09435e6852dc2e0e4 /lib/PublicInbox/LeiQuery.pm
parenta513747e10a5cc796411e901b415bbe6336c3f4d (diff)
downloadpublic-inbox-35597221da323ec3471e58fba9f04aa6e3937737.tar.gz
Because .onion URLs names are long!
Diffstat (limited to 'lib/PublicInbox/LeiQuery.pm')
-rw-r--r--lib/PublicInbox/LeiQuery.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm
index fd8a3bca..7c1e3606 100644
--- a/lib/PublicInbox/LeiQuery.pm
+++ b/lib/PublicInbox/LeiQuery.pm
@@ -94,6 +94,22 @@ sub lei_q {
         $lxs->do_query($self);
 }
 
+# shell completion helper called by lei__complete
+sub _complete_q {
+        my ($self, @argv) = @_;
+        my $ext = qr/\A(?:-I|(?:--(?:include|exclude|only)))\z/;
+        # $argv[-1] =~ $ext and return $self->_complete_forget_external;
+        my @cur;
+        while (@argv) {
+                if ($argv[-1] =~ $ext) {
+                        my @c = $self->_complete_forget_external(@cur);
+                        return @c if @c;
+                }
+                unshift(@cur, pop @argv);
+        }
+        ();
+}
+
 # Stuff we may pass through to curl (as of 7.64.0), see curl manpage for
 # details, so most options which make sense for HTTP/HTTPS (including proxy
 # support for Tor and other methods of getting past weird networks).