From a16e4816546cc098dab392eb1af4667e4961a753 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 25 Sep 2021 08:49:43 +0000 Subject: lei forget-external: split into separate file This was written before we had auto-loading, and forget-external should be a rarely-used command that's not worth loading at startup. Do some golfing while we're in the area, too. --- lib/PublicInbox/LeiQuery.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/LeiQuery.pm') diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index cb5ac8fb..c65b00ca 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -158,11 +158,11 @@ no query allowed on command-line with --stdin # shell completion helper called by lei__complete sub _complete_q { my ($self, @argv) = @_; - my $ext = qr/\A(?:-I|(?:--(?:include|exclude|only)))\z/; my @cur; + my $cb = $self->lazy_cb(qw(forget-external _complete_)); while (@argv) { - if ($argv[-1] =~ $ext) { - my @c = $self->_complete_forget_external(@cur); + if ($argv[-1] =~ /\A(?:-I|(?:--(?:include|exclude|only)))\z/) { + my @c = $cb->($self, @cur); # try basename match: if (scalar(@cur) == 1 && index($cur[0], '/') < 0) { my $all = $self->externals_each; -- cgit v1.2.3-24-ge0c7