about summary refs log tree commit homepage
path: root/script/public-inbox-compact
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-09-01 01:15:01 +0000
committerEric Wong <e@80x24.org>2020-09-02 08:53:55 +0000
commit16870b42ac68a8704467989cb20c2c571e4749ab (patch)
treeabc78c7ad8e939044909f66a64e8c2fb5fa1cd58 /script/public-inbox-compact
parent6accd690b16aa0bce7117286944d69f378611eb8 (diff)
downloadpublic-inbox-16870b42ac68a8704467989cb20c2c571e4749ab.tar.gz
`-h' doesn't conflict with anything, and some users (including
git users) may be more accustomed to using it rather than the
rarely-seen-outside-of-Getopt::Long `-?' switch.

We can also rely on the GetOptions() function to emit a proper
error message instead of just "bad command-line args".
Diffstat (limited to 'script/public-inbox-compact')
-rwxr-xr-xscript/public-inbox-compact9
1 files changed, 4 insertions, 5 deletions
diff --git a/script/public-inbox-compact b/script/public-inbox-compact
index a6bb62bd..dfebac1c 100755
--- a/script/public-inbox-compact
+++ b/script/public-inbox-compact
@@ -4,10 +4,9 @@
 use strict;
 use v5.10.1;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
-my $usage = 'public-inbox-compact INBOX_DIR';
 my $opt = { compact => 1, -coarse_lock => 1 };
 my $help = <<EOF; # the following should fit w/o scrolling in 80x24 term:
-Usage: $usage
+usage: public-inbox-compact INBOX_DIR
 
   Compact Xapian DBs in an inbox
 
@@ -18,10 +17,10 @@ options:
 
 See public-inbox-compact(1) man page for full documentation.
 EOF
-GetOptions($opt, qw(all help|?),
+GetOptions($opt, qw(all help|h),
         # compact options:
         qw(jobs|j=i quiet|q blocksize|b=s no-full|n fuller|F),
-) or die "bad command-line args\n$usage\n";
+) or die $help;
 if ($opt->{help}) { print $help; exit 0 };
 
 require PublicInbox::Admin;
@@ -31,7 +30,7 @@ PublicInbox::Admin::progress_prepare($opt);
 require PublicInbox::InboxWritable;
 require PublicInbox::Xapcmd;
 my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt);
-unless (@ibxs) { print STDERR "Usage: $usage\n"; exit 1 }
+unless (@ibxs) { print STDERR $help; exit 1 }
 foreach (@ibxs) {
         my $ibx = PublicInbox::InboxWritable->new($_);
         PublicInbox::Xapcmd::run($ibx, 'compact', $opt);