From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/4] lei lcat+inspect: start wiring up completion
Date: Sun, 30 May 2021 06:33:55 +0000 [thread overview]
Message-ID: <20210530063358.25095-2-e@80x24.org> (raw)
In-Reply-To: <20210530063358.25095-1-e@80x24.org>
Colons and other delimiters still cause problems for our bash
completion, but some completion is better than no completion.
---
lib/PublicInbox/LeiInspect.pm | 8 ++++++++
lib/PublicInbox/LeiLcat.pm | 8 ++++++++
2 files changed, 16 insertions(+)
diff --git a/lib/PublicInbox/LeiInspect.pm b/lib/PublicInbox/LeiInspect.pm
index 7205979e..eb2634b4 100644
--- a/lib/PublicInbox/LeiInspect.pm
+++ b/lib/PublicInbox/LeiInspect.pm
@@ -99,4 +99,12 @@ sub lei_inspect {
$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;
diff --git a/lib/PublicInbox/LeiLcat.pm b/lib/PublicInbox/LeiLcat.pm
index effc3682..81ab1e36 100644
--- a/lib/PublicInbox/LeiLcat.pm
+++ b/lib/PublicInbox/LeiLcat.pm
@@ -132,4 +132,12 @@ no args allowed on command-line with --stdin
$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;
next prev parent reply other threads:[~2021-05-30 6:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-30 6:33 [PATCH 0/4] lei lcat usability things Eric Wong
2021-05-30 6:33 ` Eric Wong [this message]
2021-05-30 6:33 ` [PATCH 2/4] lei lcat: allow IMAP folder URLs w/o UIDVALIDITY Eric Wong
2021-05-30 6:33 ` [PATCH 3/4] lei lcat: support maildir: paths, too Eric Wong
2021-05-30 6:33 ` [PATCH 4/4] lei: support implicit stdin by default Eric Wong
2021-05-30 11:52 ` [PATCH 0/4] lei lcat usability things Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210530063358.25095-2-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).