From 6c252b62bef579207ca417939076a9896d8a791b Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 1 Sep 2020 01:15:03 +0000 Subject: mda+learn: add --help / -h support "use Getopt::Long" doesn't seem too slow on a hot page cache, and it's probably used frequently enough to be in cache. We'll also start reducing the amount of markup in the .pod and favoring verbatim text in documentation for readability in source form, since the bold text seems excessive. --- script/public-inbox-learn | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'script/public-inbox-learn') diff --git a/script/public-inbox-learn b/script/public-inbox-learn index 5cd08d49..fb2d86ec 100755 --- a/script/public-inbox-learn +++ b/script/public-inbox-learn @@ -4,9 +4,22 @@ # # Used for training spam (via SpamAssassin) and removing messages from a # public-inbox -my $usage = "$0 0); -GetOptions(\%opt, 'all') or die "bad command-line args\n"; +GetOptions(\%opt, qw(all help|h)) or die $help; -my $train = shift or die "usage: $usage\n"; +my $train = shift or die $help; if ($train !~ /\A(?:ham|spam|rm)\z/) { - die "`$train' not recognized.\nusage: $usage\n"; + die "`$train' not recognized.\n$help"; } die "--all only works with `rm'\n" if $opt{all} && $train ne 'rm'; -- cgit v1.2.3-24-ge0c7