-use Cwd 'abs_path';
-my $usage = "public-inbox-index REPO_DIR";
-use PublicInbox::Config;
-my $config = eval { PublicInbox::Config->new } || eval {
- warn "public-inbox unconfigured for serving, indexing anyways...\n";
- {}
+my $help = <<EOF; # the following should fit w/o scrolling in 80x24 term:
+usage: public-inbox-index [options] INBOX_DIR
+
+ Create and update per-inbox search indices
+
+options:
+
+ --no-fsync speed up indexing, risk corruption on power outage
+ -L LEVEL `basic', `medium', or `full' (default: full)
+ -E EXTINDEX update extindex (default: `all')
+ --all index all configured inboxes
+ --compact | -c run public-inbox-compact(1) after indexing
+ --sequential-shard index Xapian shards sequentially for slow storage
+ --jobs=NUM set or disable parallelization (NUM=0)
+ --batch-size=BYTES flush changes to OS after a given number of bytes
+ --max-size=BYTES do not index messages larger than the given size
+ --reindex index previously indexed data (if upgrading)
+ --since=DATE limit --reindex to changes after DATE
+ --until=DATE limit --reindex to changes before DATE
+ --rethread regenerate thread IDs (if upgrading, use sparingly)
+ --prune prune git storage on discontiguous history
+ --verbose | -v increase verbosity (may be repeated)
+
+BYTES may use `k', `m', and `g' suffixes (e.g. `10m' for 10 megabytes)
+See public-inbox-index(1) man page for full documentation.
+EOF
+my $opt = {
+ quiet => -1, compact => 0, max_size => undef, fsync => 1,
+ 'update-extindex' => [], # ":s@" optional arg sets '' if no arg given