From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] lei tag: rename from "lei mark"
Date: Tue, 30 Mar 2021 09:39:27 +0000 [thread overview]
Message-ID: <20210330093927.32562-1-e@80x24.org> (raw)
I've decided "tag" is a better verb since it seems more
widely-used term for associating metadata with data.
Not only is it analogous to the "notmuch tag" command, but
also makes sense when compared to tooling for manipulating
metadata for non-mail data (e.g. audio metadata tags).
There's even a Wikipedia entry for it:
https://en.wikipedia.org/wiki/Tag_(metadata)
whereas "mark" is used in the description, but has no
entry of its own with regards to metadata.
---
Documentation/lei-overview.pod | 2 +-
Documentation/{lei-mark.pod => lei-tag.pod} | 6 ++---
Documentation/lei.pod | 2 +-
Documentation/txt2pre | 2 +-
MANIFEST | 6 ++---
Makefile.PL | 2 +-
lib/PublicInbox/LEI.pm | 6 ++---
lib/PublicInbox/{LeiMark.pm => LeiTag.pm} | 26 ++++++++++-----------
t/{lei-mark.t => lei-tag.t} | 22 ++++++++---------
9 files changed, 37 insertions(+), 37 deletions(-)
rename Documentation/{lei-mark.pod => lei-tag.pod} (89%)
rename lib/PublicInbox/{LeiMark.pm => LeiTag.pm} (90%)
rename t/{lei-mark.t => lei-tag.t} (83%)
diff --git a/Documentation/lei-overview.pod b/Documentation/lei-overview.pod
index f74a228a..c1f952c9 100644
--- a/Documentation/lei-overview.pod
+++ b/Documentation/lei-overview.pod
@@ -33,7 +33,7 @@ Show message with the git blob OID of 59ec517f9. If a message with
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.
diff --git a/Documentation/lei-mark.pod b/Documentation/lei-tag.pod
similarity index 89%
rename from Documentation/lei-mark.pod
rename to Documentation/lei-tag.pod
index 8ef1dce2..a07738d7 100644
--- a/Documentation/lei-mark.pod
+++ b/Documentation/lei-tag.pod
@@ -1,12 +1,12 @@
=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
diff --git a/Documentation/lei.pod b/Documentation/lei.pod
index 248e5931..805e5a75 100644
--- a/Documentation/lei.pod
+++ b/Documentation/lei.pod
@@ -48,7 +48,7 @@ Subcommands for initializing and managing local, writable storage:
=item * L<lei-import(1)>
-=item * L<lei-mark(1)>
+=item * L<lei-tag(1)>
=back
diff --git a/Documentation/txt2pre b/Documentation/txt2pre
index bfffdef1..7b9d7853 100755
--- a/Documentation/txt2pre
+++ b/Documentation/txt2pre
@@ -21,7 +21,7 @@ for (qw[lei(1)
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)
diff --git a/MANIFEST b/MANIFEST
index 3d521a64..f3cb0147 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -31,10 +31,10 @@ Documentation/lei-import.pod
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
@@ -195,7 +195,6 @@ lib/PublicInbox/LeiImport.pm
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
@@ -203,6 +202,7 @@ lib/PublicInbox/LeiQuery.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
@@ -386,12 +386,12 @@ t/lei-import-imap.t
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
diff --git a/Makefile.PL b/Makefile.PL
index cdb67214..27b49c53 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -46,7 +46,7 @@ $v->{-m1} = [ map {
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
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 8a07a4c8..69d48bd1 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -160,8 +160,8 @@ our %CMD = ( # sorted in order of importance/use:
'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]',
@@ -348,7 +348,7 @@ my %CONFIG_KEYS = (
'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 ($$) {
diff --git a/lib/PublicInbox/LeiMark.pm b/lib/PublicInbox/LeiTag.pm
similarity index 90%
rename from lib/PublicInbox/LeiMark.pm
rename to lib/PublicInbox/LeiTag.pm
index b187d6e7..56ac25fa 100644
--- a/lib/PublicInbox/LeiMark.pm
+++ b/lib/PublicInbox/LeiTag.pm
@@ -1,8 +1,8 @@
# 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);
@@ -69,19 +69,19 @@ sub input_eml_cb { # used by PublicInbox::LeiInput::input_fh
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
@@ -102,7 +102,7 @@ sub input_net_cb { # imap_each, nntp_each cb
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);
@@ -113,11 +113,11 @@ sub lei_mark { # the "lei mark" method
$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);
}
@@ -165,7 +165,7 @@ sub _complete_mark_common ($) {
}
# 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),
diff --git a/t/lei-mark.t b/t/lei-tag.t
similarity index 83%
rename from t/lei-mark.t
rename to t/lei-tag.t
index 98652c85..5cb6d9ce 100644
--- a/t/lei-mark.t
+++ b/t/lei-tag.t
@@ -27,13 +27,13 @@ my $check_kw = sub {
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");
@@ -43,15 +43,15 @@ test_lei(sub {
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));
@@ -62,7 +62,7 @@ test_lei(sub {
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');
@@ -70,7 +70,7 @@ test_lei(sub {
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" ],
@@ -78,7 +78,7 @@ test_lei(sub {
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));
reply other threads:[~2021-03-30 9:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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: http://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=20210330093927.32562-1-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).