X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bin%2Fdebbugs-loadsql;h=8335c7d2f5e243a28aeb2cc01336b8c7a5434f72;hb=43d2c64bb56f9a00faf1187576c8ad69b1717e90;hp=d6096ba461ad0f38b60159fe5f7ad934aa9ae261;hpb=d8746fb0bc8f3878cd165f414bad3b88af4a560d;p=debbugs.git diff --git a/bin/debbugs-loadsql b/bin/debbugs-loadsql index d6096ba..8335c7d 100755 --- a/bin/debbugs-loadsql +++ b/bin/debbugs-loadsql @@ -119,18 +119,17 @@ my %options = progress => 0, ); -my $gop = Getopt::Long::Parser->new(); -$gop->configure('pass_through'); -$gop->getoptions(\%options, - 'quick|q', - 'service|s', - 'sysconfdir|c', - 'progress!', - 'spool_dir|spool-dir=s', - 'verbose|v+', - 'quiet+', - 'debug|d+','help|h|?','man|m'); -$gop->getoptions('default'); +Getopt::Long::Configure('pass_through'); +GetOptions(\%options, + 'quick|q', + 'service|s', + 'sysconfdir|c', + 'progress!', + 'spool_dir|spool-dir=s', + 'verbose|v+', + 'quiet+', + 'debug|d+','help|h|?','man|m'); +Getopt::Long::Configure('default'); pod2usage() if $options{help}; pod2usage({verbose=>2}) if $options{man}; @@ -186,11 +185,15 @@ if ($options{progress}) { my ($subcommand) = shift @ARGV; if (not defined $subcommand) { $subcommand = 'help'; - print STDERR "You must provide a subcommand; displaying help"; + print STDERR "You must provide a subcommand; displaying usage.\n"; + pod2usage(); +} elsif (not exists $subcommands{$subcommand}) { + print STDERR "$subcommand is not a valid subcommand; displaying usage.\n"; + pod2uage(); } my $opts = - handle_subcommand_arguments(\@ARGV,$subcommands{$subcommand}{arguments},$gop); + handle_subcommand_arguments(\@ARGV,$subcommands{$subcommand}{arguments}); $subcommands{$subcommand}{function}->(\%options,$opts,$prog_bar,\%config,\@ARGV); sub add_bugs { @@ -415,7 +418,7 @@ sub add_logs { } sub handle_subcommand_arguments { - my ($argv,$args,$gop) = @_; + my ($argv,$args) = @_; my $subopt = {}; Getopt::Long::GetOptionsFromArray($argv, $subopt,