* [PATCH 00/17] lei: more random updates
@ 2021-02-06 12:18 7% Eric Wong
2021-02-06 12:18 6% ` [PATCH 02/17] lei: favor "keywords" over "flags", test --no-kw Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-02-06 12:18 UTC (permalink / raw)
To: meta
"lei add-external --mirror $URL $DESTDIR" works.
Tests are more split out and hopefully easier-to-manage
going forward (they are slowing down, though, but
more use of common setup_public_inboxes() may help).
The curl(1) short options are gone to avoid conflicts.
--help looks a bit nicer, now.
Eric Wong (17):
lei_overview: drop unnecessary autoflush call
lei: favor "keywords" over "flags", test --no-kw
lei: fix completion of --no-kw / --no-keywords
lei: abort lei_import worker on client abort
init: lowercase -j for --jobs
lei_query: trim curl options
tests: add test_lei wrapper, split out t/lei-import.t
t/lei-externals: split out into separate test
t/tests: split out setup_public_inboxes sub
tests: split out lei-daemon.t from lei.t
treewide: replace confess with croak
script/lei: avoid waitpid(-1, ...) to keep tests fast
lei: add-external --mirror support
lei help: split out into separate file
lei add-external: reject index and remote opts w/o mirror
lei_curl: replace -K/--config with --curl-config
lei: remove short switch support for curl(1) options
MANIFEST | 11 +-
Makefile.PL | 3 +
contrib/completion/lei-completion.bash | 2 +-
lib/PublicInbox/Admin.pm | 7 +-
lib/PublicInbox/DS.pm | 10 +-
lib/PublicInbox/Eml.pm | 4 +-
lib/PublicInbox/IPC.pm | 2 +-
lib/PublicInbox/LEI.pm | 200 +++++-------
lib/PublicInbox/LeiCurl.pm | 72 +++++
lib/PublicInbox/LeiExternal.pm | 46 ++-
lib/PublicInbox/LeiHelp.pm | 100 ++++++
lib/PublicInbox/LeiImport.pm | 4 +-
lib/PublicInbox/LeiMirror.pm | 288 +++++++++++++++++
lib/PublicInbox/LeiOverview.pm | 1 -
lib/PublicInbox/LeiQuery.pm | 24 +-
lib/PublicInbox/LeiXSearch.pm | 33 +-
lib/PublicInbox/OverIdx.pm | 2 +-
lib/PublicInbox/TestCommon.pm | 142 ++++++++-
script/lei | 28 +-
script/public-inbox-init | 2 +-
t/home1/.gitignore | 5 +
t/home1/Makefile | 7 +
t/home1/README | 8 +
t/lei-daemon.t | 63 ++++
t/lei-externals.t | 200 ++++++++++++
t/lei-import.t | 39 +++
t/lei-mirror.t | 30 ++
t/lei-oneshot.t | 8 -
t/lei.t | 424 +++----------------------
29 files changed, 1180 insertions(+), 585 deletions(-)
create mode 100644 lib/PublicInbox/LeiCurl.pm
create mode 100644 lib/PublicInbox/LeiHelp.pm
create mode 100644 lib/PublicInbox/LeiMirror.pm
create mode 100644 t/home1/.gitignore
create mode 100644 t/home1/Makefile
create mode 100644 t/home1/README
create mode 100644 t/lei-daemon.t
create mode 100644 t/lei-externals.t
create mode 100644 t/lei-import.t
create mode 100644 t/lei-mirror.t
delete mode 100644 t/lei-oneshot.t
^ permalink raw reply [relevance 7%]
* [PATCH 02/17] lei: favor "keywords" over "flags", test --no-kw
2021-02-06 12:18 7% [PATCH 00/17] lei: more random updates Eric Wong
@ 2021-02-06 12:18 6% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-02-06 12:18 UTC (permalink / raw)
To: meta
JMAP brain says "keywords", IMAP brain says "flags";
JMAP brain wins today.
Since "keywords" is a bit long, support "kw" as a shortcut since
there's no conflict and "kw:" will be our search prefix for
looking up messages by keyword.
---
lib/PublicInbox/LEI.pm | 7 ++++---
lib/PublicInbox/LeiImport.pm | 4 ++--
t/lei.t | 21 ++++++++++++++++++++-
3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 682d1bd1..b058b533 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -131,7 +131,7 @@ our %CMD = ( # sorted in order of importance/use:
'exclude mail matching From: or thread from non-Message-ID searches',
qw(stdin| thread|t from|f=s mid=s oid=s) ],
'mark' => [ 'MESSAGE_FLAGS...',
- 'set/unset flags on message(s) from stdin',
+ 'set/unset keywords on message(s) from stdin',
qw(stdin| oid=s exact by-mid|mid:s) ],
'forget' => [ '[--stdin|--oid=OID|--by-mid=MID]',
"exclude message(s) on stdin from `q' search results",
@@ -152,7 +152,8 @@ our %CMD = ( # sorted in order of importance/use:
'add-watch' => [ '[URL_OR_PATHNAME]',
'watch for new messages and flag changes',
- qw(import! flags! interval=s recursive|r exclude=s include=s) ],
+ qw(import! kw|keywords|flags! interval=s recursive|r
+ exclude=s include=s) ],
'ls-watch' => [ '[FILTER...]', 'list active watches with numbers and status',
qw(format|f=s z) ],
'pause-watch' => [ '[WATCH_NUMBER_OR_FILTER]', qw(all local remote) ],
@@ -163,7 +164,7 @@ our %CMD = ( # sorted in order of importance/use:
'import' => [ 'URLS_OR_PATHNAMES...|--stdin',
'one-time import/update from URL or filesystem',
qw(stdin| offset=i recursive|r exclude=s include|I=s
- format|f=s flags!),
+ format|f=s kw|keywords|flags!),
],
'config' => [ '[...]', sub {
diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm
index 4a9af8a7..2c7cbf2b 100644
--- a/lib/PublicInbox/LeiImport.pm
+++ b/lib/PublicInbox/LeiImport.pm
@@ -26,7 +26,7 @@ sub call { # the main "lei import" method
my ($cls, $lei, @argv) = @_;
my $sto = $lei->_lei_store(1);
$sto->write_prepare($lei);
- $lei->{opt}->{flags} //= 1;
+ $lei->{opt}->{kw} //= 1;
my $fmt = $lei->{opt}->{'format'};
my $self = $lei->{imp} = bless {}, $cls;
return $lei->fail('--format unspecified') if !$fmt;
@@ -63,7 +63,7 @@ sub ipc_atfork_child {
sub _import_fh {
my ($lei, $fh, $x) = @_;
- my $set_kw = $lei->{opt}->{flags};
+ my $set_kw = $lei->{opt}->{kw};
my $fmt = $lei->{opt}->{'format'};
eval {
if ($fmt eq 'eml') {
diff --git a/t/lei.t b/t/lei.t
index eb824a30..41d854e8 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -400,7 +400,26 @@ my $test_import = sub {
ok($lei->(qw(q s:boolean)), 'search hit after import');
ok($lei->(qw(import -f eml), 't/data/message_embed.eml'),
'import single file by path');
- $cleanup->();
+
+ my $str = <<'';
+From: a@b
+Message-ID: <x@y>
+Status: RO
+
+ ok($lei->([qw(import -f eml -)], undef, { %$opt, 0 => \$str }),
+ 'import single file with keywords from stdin');
+ $lei->(qw(q m:x@y));
+ my $res = $json->decode($out);
+ is($res->[1], undef, 'only one result');
+ is_deeply($res->[0]->{kw}, ['seen'], "message `seen' keyword set");
+
+ $str =~ tr/x/v/; # v@y
+ ok($lei->([qw(import --no-kw -f eml -)], undef, { %$opt, 0 => \$str }),
+ 'import single file with --no-kw from stdin');
+ $lei->(qw(q m:v@y));
+ $res = $json->decode($out);
+ is($res->[1], undef, 'only one result');
+ is_deeply($res->[0]->{kw}, [], 'no keywords set');
};
my $test_lei_common = sub {
^ permalink raw reply related [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-02-06 12:18 7% [PATCH 00/17] lei: more random updates Eric Wong
2021-02-06 12:18 6% ` [PATCH 02/17] lei: favor "keywords" over "flags", test --no-kw Eric Wong
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).