mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 13:40:07 +00:00
Update OptionParser in all tools.
This commit is contained in:
12
bin/pt-agent
12
bin/pt-agent
@@ -2963,11 +2963,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
12
bin/pt-align
12
bin/pt-align
@@ -431,11 +431,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -1158,11 +1158,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -508,11 +508,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -504,11 +504,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -1490,11 +1490,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -432,11 +432,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
12
bin/pt-find
12
bin/pt-find
@@ -924,11 +924,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -433,11 +433,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -503,11 +503,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -1240,11 +1240,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -1085,11 +1085,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
12
bin/pt-kill
12
bin/pt-kill
@@ -513,11 +513,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -520,11 +520,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -1753,11 +1753,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -433,11 +433,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -506,11 +506,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -441,11 +441,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -658,11 +658,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -2187,11 +2187,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -521,11 +521,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -870,11 +870,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -1750,11 +1750,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -510,11 +510,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
@@ -1107,11 +1107,21 @@ sub _set_option {
|
||||
my $long = exists $self->{opts}->{$opt} ? $opt
|
||||
: exists $self->{short_opts}->{$opt} ? $self->{short_opts}->{$opt}
|
||||
: die "Getopt::Long gave a nonexistent option: $opt";
|
||||
|
||||
$opt = $self->{opts}->{$long};
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
elsif ( ($opt->{type} || '') eq 's' && $val =~ m/^--?(.+)/ ) {
|
||||
my $next_opt = $1;
|
||||
if ( exists $self->{opts}->{$next_opt}
|
||||
|| exists $self->{short_opts}->{$next_opt} ) {
|
||||
$self->save_error("--$long requires a string value");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
|
Reference in New Issue
Block a user