]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
lei index: support +L: labels
authorEric Wong <e@80x24.org>
Sat, 16 Dec 2023 11:13:15 +0000 (11:13 +0000)
committerEric Wong <e@80x24.org>
Sat, 16 Dec 2023 13:06:33 +0000 (13:06 +0000)
`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
t/lei-index.t

index a89bdc5155ae3416980c5f1ee16c8a18b369fe48..17431518836bd8c62a0254c1d510b6851bb6840b 100644 (file)
@@ -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 ],
index c31b1c3cfa8c24e16751a9f108c3fe5d730e07f6..2b28f1be5ae950cfd5aae59127d14430ba108238 100644 (file)
@@ -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);