From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9C2A71FA01 for ; Tue, 2 Nov 2021 18:14:46 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 3/3] lei : stdin implies `-F eml' Date: Tue, 2 Nov 2021 18:14:45 +0000 Message-Id: <20211102181445.1897-4-e@80x24.org> In-Reply-To: <20211102181445.1897-1-e@80x24.org> References: <20211102181445.1897-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: These commands are usually run on a single message, so saving the user the trouble of typing `-F eml' on the command-line seems reasonable. I don't think commands like "index" and "import" will be too useful for single messages, though. --- lib/PublicInbox/LeiRediff.pm | 2 +- lib/PublicInbox/LeiRm.pm | 2 +- lib/PublicInbox/LeiTag.pm | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/LeiRediff.pm b/lib/PublicInbox/LeiRediff.pm index f0521bcc..c312d90f 100644 --- a/lib/PublicInbox/LeiRediff.pm +++ b/lib/PublicInbox/LeiRediff.pm @@ -256,7 +256,7 @@ sub lei_rediff { ($lei->{opt}->{drq} && !$lei->{opt}->{verbose}) and $lei->{opt}->{quiet} //= 1; $lei->_lei_store(1)->write_prepare($lei); - $lei->{opt}->{'in-format'} //= 'eml'; + $lei->{opt}->{'in-format'} //= 'eml' if $lei->{opt}->{stdin}; # maybe it's a non-email (code) blob from a coderepo my $git_dirs = $lei->{opt}->{'git-dir'} //= []; if ($lei->{opt}->{cwd} // 1) { diff --git a/lib/PublicInbox/LeiRm.pm b/lib/PublicInbox/LeiRm.pm index 62423ac9..00b12485 100644 --- a/lib/PublicInbox/LeiRm.pm +++ b/lib/PublicInbox/LeiRm.pm @@ -16,7 +16,7 @@ sub input_eml_cb { # used by PublicInbox::LeiInput::input_fh sub lei_rm { my ($lei, @inputs) = @_; $lei->_lei_store(1)->write_prepare($lei); - $lei->{opt}->{'in-format'} //= 'eml'; + $lei->{opt}->{'in-format'} //= 'eml' if $lei->{opt}->{stdin}; my $self = bless {}, __PACKAGE__; $self->prepare_inputs($lei, \@inputs) or return; $lei->{-err_type} = 'non-fatal'; diff --git a/lib/PublicInbox/LeiTag.pm b/lib/PublicInbox/LeiTag.pm index 2dc59f70..8ce96a10 100644 --- a/lib/PublicInbox/LeiTag.pm +++ b/lib/PublicInbox/LeiTag.pm @@ -27,8 +27,8 @@ sub pmdir_cb { # called via wq_io_do from LeiPmdir->each_mdir_fn sub lei_tag { # the "lei tag" method my ($lei, @argv) = @_; - my $sto = $lei->_lei_store(1); - $sto->write_prepare($lei); + $lei->{opt}->{'in-format'} //= 'eml' if $lei->{opt}->{stdin}; + my $sto = $lei->_lei_store(1)->write_prepare($lei); my $self = bless {}, __PACKAGE__; $lei->ale; # refresh and prepare my $vmd_mod = $self->vmd_mod_extract(\@argv);