unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 1/2] lei index: support +L: labels
Date: Sat, 16 Dec 2023 11:13:15 +0000	[thread overview]
Message-ID: <20231216111316.397070-2-e@80x24.org> (raw)
In-Reply-To: <20231216111316.397070-1-e@80x24.org>

`lei index' should be capable of indexing the the same way
`lei import' does, but without the indexing.  I only noticed
this omission while developing a new feature.
---
 lib/PublicInbox/LEI.pm | 2 +-
 t/lei-index.t          | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index a89bdc51..17431518 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -259,7 +259,7 @@ tag => [ 'KEYWORDS... LOCATION...|--stdin',
 
 'reindex' => [ '', 'reindex all locally-indexed messages', @c_opt ],
 
-'index' => [ 'LOCATION...', 'one-time index from URL or filesystem',
+'index' => [ 'LOCATION... [LABELS...]', 'one-time index from URL or filesystem',
 	qw(in-format|F=s kw! offset=i recursive|r exclude=s include|I=s
 	verbose|v+ incremental!), @net_opt, # mainly for --proxy=
 	 @c_opt ],
diff --git a/t/lei-index.t b/t/lei-index.t
index c31b1c3c..2b28f1be 100644
--- a/t/lei-index.t
+++ b/t/lei-index.t
@@ -48,9 +48,10 @@ symlink(File::Spec->rel2abs('t/mda-mime.eml'), "$tmpdir/md1/cur/x:2,S") or
 test_lei({ tmpdir => $tmpdir }, sub {
 	my $store_path = "$ENV{HOME}/.local/share/lei/store/";
 
-	lei_ok('index', "$tmpdir/md");
+	lei_ok qw(index +L:md), "$tmpdir/md";
 	lei_ok(qw(q mid:qp@example.com));
 	my $res_a = json_utf8->decode($lei_out);
+	is_deeply $res_a->[0]->{L}, [ 'md' ], 'label set on index';
 	my $blob = $res_a->[0]->{'blob'};
 	like($blob, qr/\A[0-9a-f]{40,}\z/, 'got blob from qp@example');
 	lei_ok(qw(-C / blob), $blob);

  reply	other threads:[~2023-12-16 11:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16 11:13 [PATCH 0/2] lei bugfixes Eric Wong
2023-12-16 11:13 ` Eric Wong [this message]
2023-12-16 11:13 ` [PATCH 2/2] lei: use ->child_error API properly 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=20231216111316.397070-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.
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).