mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
--version returned exit status 1
This commit is contained in:
@@ -784,6 +784,7 @@ sub new {
|
||||
'default' => 1,
|
||||
'cumulative' => 1,
|
||||
'negatable' => 1,
|
||||
'repeatable' => 1, # means it can be specified more than once
|
||||
);
|
||||
|
||||
my $self = {
|
||||
@@ -974,6 +975,7 @@ sub _pod_to_specs {
|
||||
desc => $para
|
||||
. (defined $attribs{default} ? " (default $attribs{default})" : ''),
|
||||
group => ($attribs{'group'} ? $attribs{'group'} : 'default'),
|
||||
attributes => \%attribs
|
||||
};
|
||||
}
|
||||
while ( $para = <$fh> ) {
|
||||
@@ -1027,6 +1029,7 @@ sub _parse_specs {
|
||||
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{is_repeatable} = $opt->{attributes}->{repeatable} ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
|
||||
$opt->{group} ||= 'default';
|
||||
@@ -1170,11 +1173,21 @@ sub _set_option {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
if ($opt->{is_repeatable}) {
|
||||
push @{$opt->{value}} , $val;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
if ($opt->{is_repeatable}) {
|
||||
push @{$opt->{value}} , $val;
|
||||
}
|
||||
else {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
}
|
||||
$opt->{got} = 1;
|
||||
PTDEBUG && _d('Got option', $long, '=', $val);
|
||||
@@ -1226,11 +1239,12 @@ sub get_opts {
|
||||
if ( exists $self->{opts}->{version} && $self->{opts}->{version}->{got} ) {
|
||||
if ( $self->{version} ) {
|
||||
print $self->{version}, "\n";
|
||||
exit 0;
|
||||
}
|
||||
else {
|
||||
print "Error parsing version. See the VERSION section of the tool's documentation.\n";
|
||||
exit 1;
|
||||
}
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if ( @ARGV && $self->{strict} ) {
|
||||
@@ -1628,6 +1642,14 @@ sub _read_config_file {
|
||||
$parse = 0;
|
||||
next LINE;
|
||||
}
|
||||
|
||||
if ( $parse
|
||||
&& !$self->has('version-check')
|
||||
&& $line =~ /version-check/
|
||||
) {
|
||||
next LINE;
|
||||
}
|
||||
|
||||
if ( $parse
|
||||
&& (my($opt, $arg) = $line =~ m/^\s*([^=\s]+?)(?:\s*=\s*(.*?)\s*)?$/)
|
||||
) {
|
||||
|
Reference in New Issue
Block a user