From 299aac294ec359a2f069e0e881ef82f55a101def Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 2 Oct 2023 15:00:23 +0000 Subject: lei: do label/keyword parsing in optparse Calling vmd_mod_extract after optparse causes the implicit stdin-as-input functionality to fail, as the implicit stdin requires a lack of inputs remaining in argv after option parsing (along with a regular file or pipe as stdin). This allows commands such as `lei import -F eml +kw:seen' to work without `--stdin', `-' or any path names when importing a single message. This also ensures commands like `lei import +kw:seen' without any inputs/locations will fail reliably, as the extra +kw: arg won't be a false-positive. --- lib/PublicInbox/LeiImport.pm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/PublicInbox/LeiImport.pm') diff --git a/lib/PublicInbox/LeiImport.pm b/lib/PublicInbox/LeiImport.pm index a324a652..c2552bf0 100644 --- a/lib/PublicInbox/LeiImport.pm +++ b/lib/PublicInbox/LeiImport.pm @@ -71,9 +71,7 @@ sub do_import_index ($$@) { my $sto = $lei->_lei_store(1); $sto->write_prepare($lei); $self->{-import_kw} = $lei->{opt}->{kw} // 1; - my $vmd_mod = $self->vmd_mod_extract(\@inputs); - return $lei->fail(join("\n", @{$vmd_mod->{err}})) if $vmd_mod->{err}; - $self->{all_vmd} = $vmd_mod if scalar keys %$vmd_mod; + $self->{all_vmd} = $lei->{vmd_mod} if keys %{$lei->{vmd_mod}}; $lei->ale; # initialize for workers to read (before LeiPmdir->new) $self->{-mail_sync} = $lei->{opt}->{'mail-sync'} // 1; $self->prepare_inputs($lei, \@inputs) or return; -- cgit v1.2.3-24-ge0c7