If indexlevel is specified on the command line prefer that. If indexlevel is specified in the config file prefer that. If indexlevel is not specified anywhere default to full.
This should make indexlevel somewhat approachable. Signed-off-by: "Eric W. Biederman" <[email protected]> --- I believe this is the other piece of the user interface needed to make indexlevel accessible. script/public-inbox-init | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/script/public-inbox-init b/script/public-inbox-init index 3ef6c3bdba2d..5e961c803203 100755 --- a/script/public-inbox-init +++ b/script/public-inbox-init @@ -16,7 +16,10 @@ use Cwd qw/abs_path/; sub x { system(@_) and die join(' ', @_). " failed: $?\n" } sub usage { print STDERR "Usage: $usage\n"; exit 1 } my $version = undef; -my %opts = ( 'V|version=i' => \$version ); +my $indexlevel = undef; +my %opts = ( 'V|version=i' => \$version, + 'L|indexlevel=s' => \$indexlevel, +); GetOptions(%opts) or usage(); my $name = shift @ARGV or usage(); my $mainrepo = shift @ARGV or usage(); @@ -64,8 +67,16 @@ if (-e $pi_config) { } exit(1) if $conflict; + + my $ibx = $cfg->lookup_name($name); + if ($ibx) { + if (!defined($indexlevel) && $ibx->{indexlevel}) { + $indexlevel = $ibx->{indexlevel}; + } + } } close $fh or die "failed to close $pi_config_tmp: $!\n"; +$indexlevel ||= 'full'; my $pfx = "publicinbox.$name"; my @x = (qw/git config/, "--file=$pi_config_tmp"); @@ -114,6 +125,7 @@ foreach my $addr (@address) { } x(@x, "$pfx.url", $http_url); x(@x, "$pfx.mainrepo", $mainrepo); +x(@x, "$pfx.indexlevel", $indexlevel); rename $pi_config_tmp, $pi_config or die "failed to rename `$pi_config_tmp' to `$pi_config': $!\n"; -- 2.17.1 -- unsubscribe: [email protected] archive: https://public-inbox.org/meta/
