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-Status: No, score=-3.8 required=3.0 tests=ALL_TRUSTED,AWL,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 2306B1FA18 for ; Sat, 26 Dec 2020 10:16:25 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/4] extindex: allow using --all without EXTINDEX_DIR Date: Sat, 26 Dec 2020 10:16:24 +0000 Message-Id: <20201226101624.26061-5-e@80x24.org> In-Reply-To: <20201226101624.26061-1-e@80x24.org> References: <20201226101624.26061-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: If "--all" is specified to index all inboxes, implicitly choose the configured [extindex "all"] external index since "--all" is incompatible with specifying inbox directories on the command-line. --- script/public-inbox-extindex | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/script/public-inbox-extindex b/script/public-inbox-extindex index f4ffda4b..5f27988f 100644 --- a/script/public-inbox-extindex +++ b/script/public-inbox-extindex @@ -6,7 +6,7 @@ use strict; use v5.10.1; use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev); my $help = <= 0\n" if defined $opt->{jobs} && $opt->{jobs} < 0; require IO::Handle; STDOUT->autoflush(1); STDERR->autoflush(1); -# require lazily to speed up --help -my $eidx_dir = shift(@ARGV) // die "E: $help"; local $SIG{USR1} = 'IGNORE'; # to be overridden in eidx_sync +# require lazily to speed up --help require PublicInbox::Admin; my $cfg = PublicInbox::Config->new; +my $eidx_dir = shift(@ARGV); +unless (defined $eidx_dir) { + if ($opt->{all} && $cfg->ALL) { + $eidx_dir = $cfg->ALL->{topdir}; + } else { + die "E: $help"; + } +} my @ibxs; if ($opt->{gc}) { die "E: inbox paths must not be specified with --gc\n" if @ARGV;