]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiUp.pm
lei ls-search: command to list saved searches
[public-inbox.git] / lib / PublicInbox / LeiUp.pm
index 386a75667a815577d2126234e044efafb5b62155..73286ea2f20f48eea9844490223efa502930fbf7 100644 (file)
@@ -9,9 +9,9 @@ use PublicInbox::LeiSavedSearch;
 use PublicInbox::LeiOverview;
 
 sub lei_up {
-       my ($lei, $dir) = @_;
+       my ($lei, $out) = @_;
        $lei->{lse} = $lei->_lei_store(1)->search;
-       my $lss = PublicInbox::LeiSavedSearch->new($lei, $dir) or return;
+       my $lss = PublicInbox::LeiSavedSearch->new($lei, $out) or return;
        my $mset_opt = $lei->{mset_opt} = { relevance => -2 };
        $mset_opt->{limit} = $lei->{opt}->{limit} // 10000;
        my $q = $mset_opt->{q_raw} = $lss->{-cfg}->{'lei.q'} //
@@ -24,7 +24,6 @@ sub lei_up {
        }
        $lei->{opt}->{output} = $lss->{-cfg}->{'lei.q.output'} //
                return $lei->fail("lei.q.output unset in $lss->{-f}");
-       $lei->{opt}->{'format'} //= $lss->{-cfg}->{'lei.q.format'}; # optional
 
        my $to_avref = $lss->{-cfg}->can('_array');
        for my $k (qw(only include exclude)) {
@@ -43,4 +42,10 @@ sub lei_up {
        $lei->_start_query;
 }
 
+sub _complete_up {
+       my ($lei, @argv) = @_;
+       my ($cur, $re) = $lei->complete_url_common(\@argv);
+       grep(/\A$re\Q$cur/, PublicInbox::LeiSavedSearch::list($lei));
+}
+
 1;