]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei tag: rename from "lei mark"
authorEric Wong <e@80x24.org>
Tue, 30 Mar 2021 09:39:27 +0000 (09:39 +0000)
committerEric Wong <e@80x24.org>
Tue, 30 Mar 2021 19:15:17 +0000 (19:15 +0000)
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
Documentation/lei-tag.pod [moved from Documentation/lei-mark.pod with 89% similarity]
Documentation/lei.pod
Documentation/txt2pre
MANIFEST
Makefile.PL
lib/PublicInbox/LEI.pm
lib/PublicInbox/LeiTag.pm [moved from lib/PublicInbox/LeiMark.pm with 90% similarity]
t/lei-tag.t [moved from t/lei-mark.t with 83% similarity]

index f74a228ab21b5de1e10cb45ce0fc56f2d1502ced..c1f952c9455d68d1d83ad30d713f318014c07d44 100644 (file)
@@ -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.
 
 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.
 
 Set the "flagged" keyword and "next" label on the message with the
 blob OID of 59ec517f9.
similarity index 89%
rename from Documentation/lei-mark.pod
rename to Documentation/lei-tag.pod
index 8ef1dce2773466fbf4eaa5ec629c69b7b98bc1c5..a07738d7bcd53a04c1320d79d96c10aa3e4d65cb 100644 (file)
@@ -1,12 +1,12 @@
 =head1 NAME
 
 =head1 NAME
 
-lei-mark - set/unset metadata on messages
+lei-tag - set/unset metadata on messages
 
 =head1 SYNOPSIS
 
 
 =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
 
 
 =head1 DESCRIPTION
 
index 248e5931c4730b6a5606d3197676f7c5a7f092c2..805e5a754bd0bd550feb5f2ff98c61c2e1577f15 100644 (file)
@@ -48,7 +48,7 @@ Subcommands for initializing and managing local, writable storage:
 
 =item * L<lei-import(1)>
 
 
 =item * L<lei-import(1)>
 
-=item * L<lei-mark(1)>
+=item * L<lei-tag(1)>
 
 =back
 
 
 =back
 
index bfffdef1f8f2d1692a23940806367e2bcec27411..7b9d7853477bcfb12af8ff95d44cbb86b3035bd5 100755 (executable)
@@ -21,7 +21,7 @@ for (qw[lei(1)
        lei-init(1)
        lei-ls-external(1)
        lei-ls-label(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)
        lei-overview(7)
        lei-p2q(1)
        lei-q(1)
index 3d521a64b440e4e2796494b5c01261daa38a3cbf..f3cb0147f5e1445ddbc8b97fd2908c770f2e6a32 100644 (file)
--- 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-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-overview.pod
 Documentation/lei-p2q.pod
 Documentation/lei-q.pod
+Documentation/lei-tag.pod
 Documentation/lei.pod
 Documentation/marketing.txt
 Documentation/mknews.perl
 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/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/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/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
 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-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-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
 t/lei.t
 t/lei_dedupe.t
 t/lei_external.t
index cdb67214527bc0a715ddec7b351192233db98048..27b49c53b4f7a6cf10f8c57b18076fd09986b373 100644 (file)
@@ -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
        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
 $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
index 8a07a4c8fda50f1a71b363d0b49ff8625f073606..69d48bd1b2da048f59e8311a990fa88917cc106e 100644 (file)
@@ -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 ],
 '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]',
        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',
 );
 
        '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 ($$) {
 
 # pronounced "exit": x_it(1 << 8) => exit(1); x_it(13) => SIGPIPE
 sub x_it ($$) {
similarity index 90%
rename from lib/PublicInbox/LeiMark.pm
rename to lib/PublicInbox/LeiTag.pm
index b187d6e76686d6b94ad0fae9dfa3ae466aa266e0..56ac25fa690fd6f83edab51a43f0db748192015a 100644 (file)
@@ -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>
 
 # 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);
 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 input_mbox_cb { input_eml_cb($_[1], $_[0]) }
 
-sub mark_done_wait { # dwaitpid callback
+sub tag_done_wait { # dwaitpid callback
        my ($arg, $pid) = @_;
        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;
 }
 
        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 ($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
 }
 
 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);
 }
 
        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);
        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');
        $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;
        $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);
 }
        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
 }
 
 # 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),
        my ($self, @argv) = @_;
        my @L = eval { $self->_lei_store->search->all_terms('L') };
        my @all = ((map { ("+kw:$_", "-kw:$_") } @KW),
similarity index 83%
rename from t/lei-mark.t
rename to t/lei-tag.t
index 98652c85134cdc6f61870c04c52b9b643433ae1c..5cb6d9ce0ac8942016477b46eb19862408c1f380 100644 (file)
@@ -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));
 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');
        $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');
        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");
        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');
        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');
        $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');
        $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 $!;
        $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));
                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]);
 
        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 %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;
        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" ],
                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(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));
        lei_ok qw(q m:testmessage@example.com);
        $check_kw->([qw(answered seen)], L => [qw(INBOX nope urgent x)]);
        lei_ok(qw(ls-label));