]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei lcat+inspect: start wiring up completion
authorEric Wong <e@80x24.org>
Sun, 30 May 2021 06:33:55 +0000 (06:33 +0000)
committerEric Wong <e@80x24.org>
Sun, 30 May 2021 08:09:08 +0000 (08:09 +0000)
Colons and other delimiters still cause problems for our bash
completion, but some completion is better than no completion.

lib/PublicInbox/LeiInspect.pm
lib/PublicInbox/LeiLcat.pm

index 7205979ed6130796a5ba20af5d841f6238cdbf19..eb2634b42a1233e11254efa918cc6f1dd55607f6 100644 (file)
@@ -99,4 +99,12 @@ sub lei_inspect {
        $lei->out(']') if $multi;
 }
 
        $lei->out(']') if $multi;
 }
 
+sub _complete_inspect {
+       my ($lei, @argv) = @_;
+       my $sto = $lei->_lei_store or return;
+       my $lms = $sto->search->lms or return;
+       my $match_cb = $lei->complete_url_prepare(\@argv);
+       map { $match_cb->($_) } $lms->folders;
+}
+
 1;
 1;
index effc36828e0000bab29d7d67a3e6d191ec1d3761..81ab1e368ca8756e1ef048d44c2ed4141d403f7d 100644 (file)
@@ -132,4 +132,12 @@ no args allowed on command-line with --stdin
        $lei->_start_query;
 }
 
        $lei->_start_query;
 }
 
+sub _complete_lcat {
+       my ($lei, @argv) = @_;
+       my $sto = $lei->_lei_store or return;
+       my $lms = $sto->search->lms or return;
+       my $match_cb = $lei->complete_url_prepare(\@argv);
+       grep(m!\A[a-z]+://!, map { $match_cb->($_) } $lms->folders);
+}
+
 1;
 1;