+
+ if ($opt->{stdin}) {
+ return $self->fail(<<'') if @argv;
+no query allowed on command-line with --stdin
+
+ require PublicInbox::InputPipe;
+ $self->{lse} = $lse; # for query_approxidate
+ PublicInbox::InputPipe::consume($self->{0}, \&qstr_add, $self);
+ return;
+ }
+ $mset_opt{qstr} = $lse->query_argv_to_string($lse->git, \@argv);
+ _start_query($self);
+}
+
+# shell completion helper called by lei__complete
+sub _complete_q {
+ my ($self, @argv) = @_;
+ my $ext = qr/\A(?:-I|(?:--(?:include|exclude|only)))\z/;
+ 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);
+ }
+ ();