#!perl -w
# Copyright (C) 2018-2021 all contributors
# License: AGPL-3.0+
use strict;
use v5.10.1;
use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
my $opt = { compact => 1, -coarse_lock => 1 };
my $help = <{help}) { print $help; exit 0 };
require PublicInbox::Admin;
PublicInbox::Admin::require_or_die('-index');
PublicInbox::Admin::progress_prepare($opt);
require PublicInbox::InboxWritable;
require PublicInbox::Xapcmd;
my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt);
unless (@ibxs) { print STDERR $help; exit 1 }
foreach (@ibxs) {
my $ibx = PublicInbox::InboxWritable->new($_);
PublicInbox::Xapcmd::run($ibx, 'compact', $opt);
}