-use PublicInbox::InboxWritable;
-use PublicInbox::Config;
-use PublicInbox::V2Writable;
-use PublicInbox::Git;
-use PublicInbox::Spawn qw(spawn);
-use Cwd 'abs_path';
-use File::Copy 'cp'; # preserves permissions:
-my $usage = "Usage: public-inbox-convert OLD NEW\n";
-my $jobs;
-my $index = 1;
-my %opts = (
- '--jobs|j=i' => \$jobs,
- '--index!' => \$index,
-);
-GetOptions(%opts) or die "bad command-line args\n$usage";
-my $old_dir = shift(@ARGV) or die $usage;
-my $new_dir = shift(@ARGV) or die $usage;
+my $help = <<EOF; # the following should fit w/o scrolling in 80x24 term:
+usage: public-inbox-convert [options] OLD NEW
+
+ convert v1 format inboxes to v2
+
+options:
+
+ --no-index do not index after conversion
+ --jobs=NUM set shards (NUM=0)
+ --verbose | -v increase verbosity (may be repeated)
+
+index options (see public-inbox-index(1) man page for full description):
+
+ --no-fsync speed up indexing, risk corruption on power outage
+ -L LEVEL `basic', `medium', or `full' (default: full)
+ --compact | -c run public-inbox-compact(1) after indexing
+ --sequential-shard index Xapian shards sequentially for slow storage
+ --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
+
+See public-inbox-convert(1) man page for full documentation.
+EOF
+
+my $opt = {
+ index => 1,
+ # index defaults:
+ quiet => -1, compact => 0, maxsize => undef, fsync => 1,
+ reindex => 1, # we always reindex
+};
+GetOptions($opt, qw(jobs|j=i index! help|h),
+ # index options
+ qw(verbose|v+ rethread compact|c+ fsync|sync!
+ indexlevel|index-level|L=s max_size|max-size=s
+ batch_size|batch-size=s
+ sequential_shard|sequential-shard|seq-shard
+ )) or die $help;
+if ($opt->{help}) { print $help; exit 0 };
+my $old_dir = shift(@ARGV) // '';
+my $new_dir = shift(@ARGV) // '';
+die $help if (scalar(@ARGV) || $new_dir eq '' || $old_dir eq '');