'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",
'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) ],
'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 {
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;
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') {
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 {