about summary refs log tree commit homepage
path: root/script/public-inbox-index
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-index
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-index')
-rwxr-xr-xscript/public-inbox-index10
1 files changed, 4 insertions, 6 deletions
diff --git a/script/public-inbox-index b/script/public-inbox-index
index cb11075e..5dad6ecb 100755
--- a/script/public-inbox-index
+++ b/script/public-inbox-index
@@ -8,9 +8,8 @@
 use strict;
 use v5.10.1;
 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
-my $usage = 'public-inbox-index [options] INBOX_DIR';
 my $help = <<EOF; # the following should fit w/o scrolling in 80x24 term:
-usage: $usage
+usage: public-inbox-index [options] INBOX_DIR
 
   Create and update search indices
 
@@ -28,7 +27,6 @@ options:
   --rethread          regenerate thread IDs (if upgrading, use sparingly)
   --prune             prune git storage on discontiguous history
   --verbose | -v      increase verbosity (may be repeated)
-  --help | -?         show this help
 
 BYTES may use `k', `m', and `g' suffixes (e.g. `10m' for 10 megabytes)
 See public-inbox-index(1) man page for full documentation.
@@ -39,8 +37,8 @@ GetOptions($opt, qw(verbose|v+ reindex rethread compact|c+ jobs|j=i prune
                 indexlevel|index-level|L=s max_size|max-size=s
                 batch_size|batch-size=s
                 sequential_shard|seq-shard|sequential-shard
-                skip-docdata all help|?))
-        or die "bad command-line args\n$usage";
+                skip-docdata all help|h))
+        or die $help;
 if ($opt->{help}) { print $help; exit 0 };
 die "--jobs must be >= 0\n" if defined $opt->{jobs} && $opt->{jobs} < 0;
 if ($opt->{xapian_only} && !$opt->{reindex}) {
@@ -54,7 +52,7 @@ PublicInbox::Admin::require_or_die('-index');
 my $cfg = PublicInbox::Config->new; # Config is loaded by Admin
 my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg);
 PublicInbox::Admin::require_or_die('-index');
-unless (@ibxs) { print STDERR "Usage: $usage\n"; exit 1 }
+unless (@ibxs) { print STDERR $help; exit 1 }
 
 my $mods = {};
 foreach my $ibx (@ibxs) {