that OID isn't found, check if the current git repository has the
blob, trying to reconstruct it from a message if needed.
-=item $ lei blob 59ec517f9 | lei mark - -F eml +kw:flagged +L:next
+=item $ lei blob 59ec517f9 | lei tag - -F eml +kw:flagged +L:next
Set the "flagged" keyword and "next" label on the message with the
blob OID of 59ec517f9.
=head1 NAME
-lei-mark - set/unset metadata on messages
+lei-tag - set/unset metadata on messages
=head1 SYNOPSIS
-lei mark [OPTIONS] FILE [FILE...] METADATA [METADATA...]
+lei tag [OPTIONS] FILE [FILE...] METADATA [METADATA...]
-lei mark [OPTIONS] (-|--stdin) METADATA [METADATA...]
+lei tag [OPTIONS] (-|--stdin) METADATA [METADATA...]
=head1 DESCRIPTION
=item * L<lei-import(1)>
-=item * L<lei-mark(1)>
+=item * L<lei-tag(1)>
=back
lei-init(1)
lei-ls-external(1)
lei-ls-label(1)
- lei-mark(1)
+ lei-tag(1)
lei-overview(7)
lei-p2q(1)
lei-q(1)
Documentation/lei-init.pod
Documentation/lei-ls-external.pod
Documentation/lei-ls-label.pod
-Documentation/lei-mark.pod
Documentation/lei-overview.pod
Documentation/lei-p2q.pod
Documentation/lei-q.pod
+Documentation/lei-tag.pod
Documentation/lei.pod
Documentation/marketing.txt
Documentation/mknews.perl
lib/PublicInbox/LeiInit.pm
lib/PublicInbox/LeiInput.pm
lib/PublicInbox/LeiLsLabel.pm
-lib/PublicInbox/LeiMark.pm
lib/PublicInbox/LeiMirror.pm
lib/PublicInbox/LeiOverview.pm
lib/PublicInbox/LeiP2q.pm
lib/PublicInbox/LeiRemote.pm
lib/PublicInbox/LeiSearch.pm
lib/PublicInbox/LeiStore.pm
+lib/PublicInbox/LeiTag.pm
lib/PublicInbox/LeiToMail.pm
lib/PublicInbox/LeiXSearch.pm
lib/PublicInbox/Linkify.pm
t/lei-import-maildir.t
t/lei-import-nntp.t
t/lei-import.t
-t/lei-mark.t
t/lei-mirror.t
t/lei-p2q.t
t/lei-q-kw.t
t/lei-q-remote-import.t
t/lei-q-thread.t
+t/lei-tag.t
t/lei.t
t/lei_dedupe.t
t/lei_external.t
qw(
lei-add-external lei-blob lei-config lei-daemon-kill lei-daemon-pid
lei-forget-external lei-import lei-init lei-ls-external lei-ls-label
- lei-mark lei-p2q lei-q)];
+ lei-tag lei-p2q lei-q)];
$v->{-m5} = [ qw(public-inbox-config public-inbox-v1-format
public-inbox-v2-format public-inbox-extindex-format) ];
$v->{-m7} = [ qw(lei-overview public-inbox-overview public-inbox-tuning
'plonk' => [ '--threads|--from=IDENT',
'exclude mail matching From: or threads from non-Message-ID searches',
qw(stdin| threads|t from|f=s mid=s oid=s), @c_opt ],
-'mark' => [ 'KEYWORDS...',
- 'set/unset keywords on message(s)',
+'tag' => [ 'KEYWORDS...',
+ 'set/unset keywords and/or labels on message(s)',
qw(stdin| in-format|F=s input|i=s@ oid=s@ mid=s@), @c_opt,
pass_through('-kw:foo for delete') ],
'forget' => [ '[--stdin|--oid=OID|--by-mid=MID]',
'leistore.dir' => 'top-level storage location',
);
-my @WQ_KEYS = qw(lxs l2m imp mrr cnv p2q mark sol); # internal workers
+my @WQ_KEYS = qw(lxs l2m imp mrr cnv p2q tag sol); # internal workers
# pronounced "exit": x_it(1 << 8) => exit(1); x_it(13) => SIGPIPE
sub x_it ($$) {
# Copyright (C) 2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-# handles "lei mark" command
-package PublicInbox::LeiMark;
+# handles "lei tag" command
+package PublicInbox::LeiTag;
use strict;
use v5.10.1;
use parent qw(PublicInbox::IPC PublicInbox::LeiInput);
sub input_mbox_cb { input_eml_cb($_[1], $_[0]) }
-sub mark_done_wait { # dwaitpid callback
+sub tag_done_wait { # dwaitpid callback
my ($arg, $pid) = @_;
- my ($mark, $lei) = @$arg;
- $lei->child_error($?, 'non-fatal errors during mark') if $?;
+ my ($tag, $lei) = @$arg;
+ $lei->child_error($?, 'non-fatal errors during tag') if $?;
my $sto = delete $lei->{sto};
my $wait = $sto->ipc_do('done') if $sto; # PublicInbox::LeiStore::done
$lei->dclose;
}
-sub mark_done { # EOF callback for main daemon
+sub tag_done { # EOF callback for main daemon
my ($lei) = @_;
- my $mark = delete $lei->{mark} or return;
- $mark->wq_wait_old(\&mark_done_wait, $lei);
+ my $tag = delete $lei->{tag} or return;
+ $tag->wq_wait_old(\&tag_done_wait, $lei);
}
sub net_merge_complete { # callback used by LeiAuth
input_eml_cb($self, $eml);
}
-sub lei_mark { # the "lei mark" method
+sub lei_tag { # the "lei tag" method
my ($lei, @argv) = @_;
my $sto = $lei->_lei_store(1);
$sto->write_prepare($lei);
$self->prepare_inputs($lei, \@argv) or return;
grep(defined, @$vmd_mod{qw(+kw +L -L -kw)}) or
return $lei->fail('no keywords or labels specified');
- my $ops = { '' => [ \&mark_done, $lei ] };
+ my $ops = { '' => [ \&tag_done, $lei ] };
$lei->{auth}->op_merge($ops, $self) if $lei->{auth};
$self->{vmd_mod} = $vmd_mod;
- my ($op_c, undef) = $lei->workers_start($self, 'lei_mark', 1, $ops);
- $lei->{mark} = $self;
+ my ($op_c, undef) = $lei->workers_start($self, 'lei_tag', 1, $ops);
+ $lei->{tag} = $self;
net_merge_complete($self) unless $lei->{auth};
$op_c->op_wait_event($ops);
}
}
# FIXME: same problems as _complete_forget_external and similar
-sub _complete_mark {
+sub _complete_tag {
my ($self, @argv) = @_;
my @L = eval { $self->_lei_store->search->all_terms('L') };
my @all = ((map { ("+kw:$_", "-kw:$_") } @KW),
test_lei(sub {
lei_ok(qw(ls-label)); is($lei_out, '', 'no labels, yet');
lei_ok(qw(import t/utf8.eml));
- lei_ok(qw(mark t/utf8.eml +kw:flagged +L:urgent));
+ lei_ok(qw(tag t/utf8.eml +kw:flagged +L:urgent));
$check_kw->(['flagged'], L => ['urgent']);
lei_ok(qw(ls-label)); is($lei_out, "urgent\n", 'label found');
- ok(!lei(qw(mark -F eml t/utf8.eml +kw:seeen)), 'bad kw rejected');
+ ok(!lei(qw(tag -F eml t/utf8.eml +kw:seeen)), 'bad kw rejected');
like($lei_err, qr/`seeen' is not one of/, 'got helpful error');
- ok(!lei(qw(mark -F eml t/utf8.eml +k:seen)), 'bad prefix rejected');
- ok(!lei(qw(mark -F eml t/utf8.eml)), 'no keywords');
+ ok(!lei(qw(tag -F eml t/utf8.eml +k:seen)), 'bad prefix rejected');
+ ok(!lei(qw(tag -F eml t/utf8.eml)), 'no keywords');
my $mb = "$ENV{HOME}/mb";
my $md = "$ENV{HOME}/md";
lei_ok(qw(q m:testmessage@example.com -o), "mboxrd:$mb");
scalar(@fn) == 1 or xbail $lei_err, 'no mail', \@fn;
rename($fn[0], "$fn[0]S") or BAIL_OUT "rename $!";
$check_kw->(['flagged'], msg => 'after bad request');
- lei_ok(qw(mark -F eml t/utf8.eml -kw:flagged));
+ lei_ok(qw(tag -F eml t/utf8.eml -kw:flagged));
$check_kw->(undef, msg => 'keyword cleared');
- lei_ok(qw(mark -F mboxrd +kw:seen), $mb);
+ lei_ok(qw(tag -F mboxrd +kw:seen), $mb);
$check_kw->(['seen'], msg => 'mbox Status ignored');
- lei_ok(qw(mark -kw:seen +kw:answered), $md);
+ lei_ok(qw(tag -kw:seen +kw:answered), $md);
$check_kw->(['answered'], msg => 'Maildir Status ignored');
open my $in, '<', 't/utf8.eml' or BAIL_OUT $!;
- lei_ok([qw(mark -F eml - +kw:seen +L:nope)],
+ lei_ok([qw(tag -F eml - +kw:seen +L:nope)],
undef, { %$lei_opt, 0 => $in });
$check_kw->(['answered', 'seen'], msg => 'stdin works');
lei_ok(qw(q L:urgent));
is_deeply($r2, $res, 'kw: query works, too') or
diag explain([$r2, $res]);
- lei_ok(qw(_complete lei mark));
+ lei_ok(qw(_complete lei tag));
my %c = map { $_ => 1 } split(/\s+/, $lei_out);
ok($c{'+L:urgent'} && $c{'-L:urgent'} &&
$c{'+L:nope'} && $c{'-L:nope'}, 'completed with labels');
my $mid = 'qp@example.com';
lei_ok qw(q -f mboxrd --only), "$ro_home/t2", "mid:$mid";
$in = $lei_out;
- lei_ok [qw(mark -F mboxrd --stdin +kw:seen +L:qp)],
+ lei_ok [qw(tag -F mboxrd --stdin +kw:seen +L:qp)],
undef, { %$lei_opt, 0 => \$in };
$check_kw->(['seen'], L => ['qp'], mid => $mid,
args => [ '--only', "$ro_home/t2" ],
lei_ok(qw(ls-label));
is($lei_out, "nope\nqp\nurgent\n", 'ls-label shows qp');
- lei_ok qw(mark -F eml t/utf8.eml +L:INBOX +L:x); diag $lei_err;
+ lei_ok qw(tag -F eml t/utf8.eml +L:INBOX +L:x); diag $lei_err;
lei_ok qw(q m:testmessage@example.com);
$check_kw->([qw(answered seen)], L => [qw(INBOX nope urgent x)]);
lei_ok(qw(ls-label));