diff options
author | Eric Wong <e@80x24.org> | 2021-02-02 22:11:39 -1000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-04 01:37:09 +0000 |
commit | d692a0550b58bb16770000aeaffb0308da0c9328 (patch) | |
tree | 8a700490411e254aea64ee5fc9eee0a1611aa87a /lib | |
parent | 9c38d7f9a5d2575dc6f7179c4e69fb1cb3d6b871 (diff) | |
download | public-inbox-d692a0550b58bb16770000aeaffb0308da0c9328.tar.gz |
This will make it even easier for RSI-afflicted users to use, since many externals may share a common prefix.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/LeiQuery.pm | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/PublicInbox/LeiQuery.pm b/lib/PublicInbox/LeiQuery.pm index 10b8d6fa..8015ecec 100644 --- a/lib/PublicInbox/LeiQuery.pm +++ b/lib/PublicInbox/LeiQuery.pm @@ -112,11 +112,22 @@ sub lei_q { 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); + # try basename match: + if (scalar(@cur) == 1 && index($cur[0], '/') < 0) { + my $all = $self->externals_each; + my %bn; + for my $loc (keys %$all) { + my $bn = (split(m!/!, $loc))[-1]; + ++$bn{$bn}; + } + push @c, grep { + $bn{$_} == 1 && /\A\Q$cur[0]/ + } keys %bn; + } return @c if @c; } unshift(@cur, pop @argv); |