Simplify GetOptions() code

This commit is contained in:
Adam Spiers 2011-11-17 14:12:12 +00:00
parent ca49579fa1
commit ba3c052c1f

12
stow.in
View file

@ -170,15 +170,9 @@ sub process_options {
Getopt::Long::config('no_ignore_case', 'bundling', 'permute'); Getopt::Long::config('no_ignore_case', 'bundling', 'permute');
GetOptions( GetOptions(
'v' => sub { $Option{'verbose'}++ }, \%Option,
'verbose:i' => sub { $Option{'verbose'}+= $_[1] || 1 }, 'verbose|v:+', 'help|h', 'simulate|n|no', 'conflicts|c',
'h|help' => sub { $Option{'help'} = '1' }, 'version|V', 'compat|p', 'dir|d=s', 'target|t=s',
'n|no|simulate' => sub { $Option{'simulate'} = '1' },
'c|conflicts' => sub { $Option{'conflicts'} = '1' },
'V|version' => sub { $Option{'version'} = '1' },
'p|compat' => sub { $Option{'compat'} = '1' },
'd|dir=s' => sub { $Option{'dir'} = $_[1] },
't|target=s' => sub { $Option{'target'} = $_[1] },
# clean and pre-compile any regex's at parse time # clean and pre-compile any regex's at parse time
'ignore=s' => 'ignore=s' =>