mirror of
https://github.com/xcat2/xNBA.git
synced 2025-01-22 15:33:14 +00:00
[build] Simplify use of Getopt::Long in padimg.pl
Sometimes it's just so much fun doing things the complicated way that you forget to check the man page for the existence of a simpler syntax.
This commit is contained in:
parent
7aee624881
commit
b4a87daeb9
@ -9,16 +9,15 @@ my $verbosity = 0;
|
||||
my $blksize = 512;
|
||||
my $byte = 0;
|
||||
|
||||
my $opts = {
|
||||
my %opts = (
|
||||
'verbose|v+' => sub { $verbosity++; },
|
||||
'quiet|q+' => sub { $verbosity--; },
|
||||
'blksize|s=o' => sub { $blksize = $_[1]; },
|
||||
'byte|b=o' => sub { $byte = $_[1]; },
|
||||
};
|
||||
);
|
||||
|
||||
Getopt::Long::Configure ( 'bundling', 'auto_abbrev' );
|
||||
GetOptions ( { map { /^(\w+)/; $1 => $opts->{$_} } keys %$opts }, keys %$opts )
|
||||
or die "Could not parse command-line options\n";
|
||||
GetOptions ( %opts ) or die "Could not parse command-line options\n";
|
||||
|
||||
while ( my $filename = shift ) {
|
||||
die "$filename is not a file\n" unless -f $filename;
|
||||
|
Loading…
x
Reference in New Issue
Block a user