use File::Path qw(mkpath);
use File::Spec;
our $quit = \&CORE::exit;
-our ($current_lei, $errors_log, $listener);
+our ($current_lei, $errors_log, $listener, $oldset);
my ($recv_cmd, $send_cmd);
my $GLP = Getopt::Long::Parser->new;
$GLP->configure(qw(gnu_getopt no_ignore_case auto_abbrev));
# command => [ positional_args, 1-line description, Getopt::Long option spec ]
our %CMD = ( # sorted in order of importance/use:
'q' => [ '--stdin|SEARCH_TERMS...', 'search for messages matching terms', qw(
- save-as=s output|mfolder|o=s format|f=s dedupe|d=s threads|t augment|a
+ save-as=s output|mfolder|o=s format|f=s dedupe|d=s threads|t+ augment|a
sort|s=s reverse|r offset=i remote! local! external! pretty
include|I=s@ exclude=s@ only=s@ jobs|j=s globoff|g stdin|
- import-remote!
+ import-remote! lock=s@
alert=s@ mua=s no-torsocks torsocks=s verbose|v+ quiet|q C=s@),
PublicInbox::LeiQuery::curl_opt(), opt_dash('limit|n=i', '[0-9]+') ],
'import' => [ 'LOCATION...|--stdin',
'one-time import/update from URL or filesystem',
qw(stdin| offset=i recursive|r exclude=s include|I=s
- format|f=s kw|keywords|flags! C=s@),
+ in-format|F=s kw|keywords|flags! C=s@),
],
'convert' => [ 'LOCATION...|--stdin',
'one-time conversion from URL or filesystem to another format',
'dedupe|d=s' => ['STRATEGY|content|oid|mid|none',
'deduplication strategy'],
'show threads|t' => 'display entire thread a message belongs to',
-'q threads|t' =>
+'q threads|t+' =>
'return all messages in the same threads as the actual match(es)',
'alert=s@' => ['CMD,:WINCH,:bell,<any command>',
'run command(s) or perform ops when done writing to output ' .
undef;
}
-sub check_input_format ($;$$) {
- my ($self, $files, $opt_key) = @_;
- $opt_key //= 'format';
+sub check_input_format ($;$) {
+ my ($self, $files) = @_;
+ my $opt_key = 'in-format';
my $fmt = $self->{opt}->{$opt_key};
if (!$fmt) {
my $err = $files ? "regular file(s):\n@$files" : '--stdin';
sub noop {}
-our $oldset; sub oldset { $oldset }
+sub oldset { $oldset }
sub dump_and_clear_log {
if (defined($errors_log) && -s STDIN && seek(STDIN, 0, SEEK_SET)) {