]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiQuery.pm
lei_query: fix comment about %lei2curl commands
[public-inbox.git] / lib / PublicInbox / LeiQuery.pm
index 0435a5163137a4f0693bf7374bf544041aa0ace0..d5f132f1d4d393160e48a6487d12792cb551f2ed 100644 (file)
@@ -1,7 +1,8 @@
 # Copyright (C) 2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
-# handles lei <q|ls-query|rm-query|mv-query> commands
+# handles "lei q" command and provides internals for
+# several other sub-commands (up, lcat, ...)
 package PublicInbox::LeiQuery;
 use strict;
 use v5.10.1;
@@ -72,7 +73,7 @@ sub lxs_prepare {
        my @only = @{$opt->{only} // []};
        # --local is enabled by default unless --only is used
        # we'll allow "--only $LOCATION --local"
-       my $sto = $self->_lei_store(1); # FIXME: should not create
+       my $sto = $self->_lei_store(1);
        $self->{lse} = $sto->search;
        if ($opt->{'local'} //= scalar(@only) ? 0 : 1) {
                $lxs->prepare_external($self->{lse});
@@ -115,7 +116,7 @@ sub lei_q {
        my ($self, @argv) = @_;
        PublicInbox::Config->json; # preload before forking
        my $lxs = lxs_prepare($self) or return;
-       $self->ale->refresh_externals($lxs);
+       $self->ale->refresh_externals($lxs, $self);
        my $opt = $self->{opt};
        my %mset_opt = map { $_ => $opt->{$_} } qw(threads limit offset);
        $mset_opt{asc} = $opt->{'reverse'} ? 1 : 0;
@@ -130,6 +131,8 @@ sub lei_q {
                } else {
                        die "unrecognized --sort=$sort\n";
                }
+               $opt->{save} and return
+                       $self->fail('--save and --sort are incompatible');
        }
        $self->{mset_opt} = \%mset_opt;
 
@@ -187,7 +190,7 @@ sub _complete_q {
 # analogues in git(1)? that would reduce likelyhood of conflicts with
 # our other CLI options
 # Note: some names are renamed to avoid potential conflicts,
-# see %lei2mail in lib/PublicInbox/LeiCurl.pm
+# see %lei2curl in lib/PublicInbox/LeiCurl.pm
 sub curl_opt { qw(
        curl-config=s@
        abstract-unix-socket=s anyauth basic cacert=s capath=s