* [PATCH 8/8] lei rm: move generic input_maildir_cb to LeiInput parent class
2021-10-28 11:14 6% [PATCH 0/8] lei: docs and cleanups Eric Wong
@ 2021-10-28 11:15 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-10-28 11:15 UTC (permalink / raw)
To: meta
It's not much of a savings, right now, but maybe it can be in the
future. I wanted to eliminate the "lei convert" one, too, but
convert needs to preserve keywords which isn't possible with the
generic fallback, so new tests were written for convert, instead.
---
lib/PublicInbox/LeiInput.pm | 5 +++++
lib/PublicInbox/LeiRm.pm | 5 -----
t/lei-convert.t | 10 ++++++++++
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm
index 540681e3ff6b..84fc579dc480 100644
--- a/lib/PublicInbox/LeiInput.pm
+++ b/lib/PublicInbox/LeiInput.pm
@@ -64,6 +64,11 @@ sub input_mbox_cb { # base MboxReader callback
$self->input_eml_cb($eml);
}
+sub input_maildir_cb {
+ my ($fn, $kw, $eml, $self) = @_;
+ $self->input_eml_cb($eml);
+}
+
sub input_net_cb { # imap_each, nntp_each cb
my ($url, $uid, $kw, $eml, $self) = @_;
$self->input_eml_cb($eml);
diff --git a/lib/PublicInbox/LeiRm.pm b/lib/PublicInbox/LeiRm.pm
index 524c178e3b47..cc1abbff66cb 100644
--- a/lib/PublicInbox/LeiRm.pm
+++ b/lib/PublicInbox/LeiRm.pm
@@ -13,11 +13,6 @@ sub input_eml_cb { # used by PublicInbox::LeiInput::input_fh
$self->{lei}->{sto}->wq_do('remove_eml', $eml);
}
-sub input_maildir_cb {
- my (undef, $kw, $eml, $self) = @_; # $_[0] $filename ignored
- input_eml_cb($self, $eml);
-}
-
sub lei_rm {
my ($lei, @inputs) = @_;
$lei->_lei_store(1)->write_prepare($lei);
diff --git a/t/lei-convert.t b/t/lei-convert.t
index 0ea860c82189..e1849ff796cd 100644
--- a/t/lei-convert.t
+++ b/t/lei-convert.t
@@ -115,5 +115,15 @@ test_lei({ tmpdir => $tmpdir }, sub {
@bar = ();
PublicInbox::MboxReader->mboxrd($fh, sub { push @bar, shift });
is_deeply(\@bar, [ $qp_eml ], 'readed gzipped mboxrd');
+
+ # Status => Maildir flag => Status round trip
+ $lei_out =~ s/^Status: O/Status: RO/sm or xbail "`seen' Status";
+ $rdr = { 0 => \($in = $lei_out), %$lei_opt };
+ lei_ok([qw(convert -F mboxrd -o), "$d/md2"], undef, $rdr);
+ @md = glob("$d/md2/*/*");
+ is(scalar(@md), 1, 'one message');
+ like($md[0], qr/:2,S\z/, "`seen' flag set in Maildir");
+ lei_ok(qw(convert -o mboxrd:/dev/stdout), "$d/md2");
+ like($lei_out, qr/^Status: RO/sm, "`seen' flag preserved");
});
done_testing;
^ permalink raw reply related [relevance 7%]
* [PATCH 0/8] lei: docs and cleanups
@ 2021-10-28 11:14 6% Eric Wong
2021-10-28 11:15 7% ` [PATCH 8/8] lei rm: move generic input_maildir_cb to LeiInput parent class Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-10-28 11:14 UTC (permalink / raw)
To: meta
Expect more on the way. As always some bugs and fixes were
found while attempting to write docs :x
Eric Wong (8):
xt/net_writer_imap: test "lei convert" w/ IMAP source
lei convert: use "--output" in failure message
doc: lei-convert: various updates and cleanups
doc: lei blob: wording fixups, describe --remote
lei convert: remove redundant input_net_cb
doc: lei-add-watch: add warning about unreliability
lei sucks: show nproc in CPU info
lei rm: move generic input_maildir_cb to LeiInput parent class
Documentation/lei-add-watch.pod | 8 ++++++--
Documentation/lei-blob.pod | 12 ++++++++----
Documentation/lei-convert.pod | 21 +++++++++------------
lib/PublicInbox/LeiConvert.pm | 8 ++------
lib/PublicInbox/LeiInput.pm | 5 +++++
lib/PublicInbox/LeiRm.pm | 5 -----
lib/PublicInbox/LeiSucks.pm | 4 +++-
t/lei-convert.t | 10 ++++++++++
xt/net_writer-imap.t | 7 +++++++
9 files changed, 50 insertions(+), 30 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-10-28 11:14 6% [PATCH 0/8] lei: docs and cleanups Eric Wong
2021-10-28 11:15 7% ` [PATCH 8/8] lei rm: move generic input_maildir_cb to LeiInput parent class 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).