lib/PublicInbox/LEI.pm | 2 +- lib/PublicInbox/LeiUp.pm | 21 ++++++++++++++++++--- diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 54fac7b4f14fcf3a26f67d3ec8b3614d39d0b49a..7d0f63dca4a7b2dcbb519cdd9b32e9a7a237150a 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -178,7 +178,7 @@ sort|s=s reverse|r offset=i pretty jobs|j=s globoff|g augment|a import-before! lock=s@ rsyncable alert=s@ mua=s verbose|v+ shared color! mail-sync!), @c_opt, opt_dash('limit|n=i', '[0-9]+') ], -'up' => [ 'OUTPUT|--all', 'update saved search', +'up' => [ 'OUTPUT...|--all', 'update saved search', qw(jobs|j=s lock=s@ alert=s@ mua=s verbose|v+ all:s), @c_opt ], 'lcat' => [ '--stdin|MSGID_OR_URL...', 'display local copy of message(s)', diff --git a/lib/PublicInbox/LeiUp.pm b/lib/PublicInbox/LeiUp.pm index 3356d11e1fe6b7e4f399d9c8ef54816d47aae7ac..49b558fdb2932f2be458e57c2489c8ec2ce2ca32 100644 --- a/lib/PublicInbox/LeiUp.pm +++ b/lib/PublicInbox/LeiUp.pm @@ -61,11 +61,13 @@ $l->err($@) if $@; } sub lei_up { - my ($lei, $out) = @_; + my ($lei, @outs) = @_; $lei->{lse} = $lei->_lei_store(1)->search; my $opt = $lei->{opt}; $opt->{save} = -1; + my @local; if (defined $opt->{all}) { + return $lei->fail("--all and @outs incompatible") if @outs; length($opt->{mua}//'') and return $lei->fail('--all and --mua= are incompatible'); @@ -74,7 +76,20 @@ # git-credential prompts. TODO: add this in 1.8 $opt->{all} eq 'local' or return $lei->fail('only --all=local works at the moment'); my @all = PublicInbox::LeiSavedSearch::list($lei); - my @local = grep(!m!\Aimaps?://!i, @all); + @local = grep(!m!\Aimaps?://!i, @all); + } else { + @local = @outs; + } + if (scalar(@outs) > 1) { + length($opt->{mua}//'') and return $lei->fail(<fail(< 1) { $lei->_lei_store->write_prepare($lei); # share early # daemon mode, re-dispatch into our event loop w/o # creating an extra fork-level @@ -89,7 +104,7 @@ } $lei->event_step_init; $op_c->{ops} = { '' => [$lei->can('dclose'), $lei] }; } else { - up1($lei, $out); + up1($lei, $local[0]); } }