Fix the usage for non-boolean options, always print the
description. This fixes the output of 'make_filter --help'.
This commit is contained in:
parent
d9c97f37d9
commit
1d691d5d70
|
@ -39,7 +39,7 @@ my %options_long = (
|
||||||
|
|
||||||
"make" => { default => "make",
|
"make" => { default => "make",
|
||||||
parser => \&parse_value,
|
parser => \&parse_value,
|
||||||
description => "use which make" },
|
description => "Specifies the make command" },
|
||||||
"pedantic" => { default => 0, description => "be pedantic" },
|
"pedantic" => { default => 0, description => "be pedantic" },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -331,20 +331,20 @@ sub show_help {
|
||||||
for my $name (sort(keys(%$options_long))) {
|
for my $name (sort(keys(%$options_long))) {
|
||||||
my $option = $$options_long{$name};
|
my $option = $$options_long{$name};
|
||||||
my $description = $$option{description};
|
my $description = $$option{description};
|
||||||
my $default = $$option{default};
|
my $parser = $$option{parser};
|
||||||
my $current = ${$self->{$$option{key}}};
|
my $current = ${$self->{$$option{key}}};
|
||||||
|
|
||||||
my $value = $current;
|
my $value = $current;
|
||||||
|
|
||||||
my $command;
|
my $command;
|
||||||
if(ref($value) ne "HASH") {
|
if(!defined $parser) {
|
||||||
if($value) {
|
if($value) {
|
||||||
$command = "--no-$name";
|
$command = "--no-$name";
|
||||||
} else {
|
} else {
|
||||||
$command = "--$name";
|
$command = "--$name";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if($value->{active}) {
|
if(ref($value) eq "HASH" && $value->{active}) {
|
||||||
$command = "--[no-]$name\[=<value>]";
|
$command = "--[no-]$name\[=<value>]";
|
||||||
} else {
|
} else {
|
||||||
$command = "--$name\[=<value>]";
|
$command = "--$name\[=<value>]";
|
||||||
|
@ -352,23 +352,24 @@ sub show_help {
|
||||||
}
|
}
|
||||||
|
|
||||||
$output->write($command);
|
$output->write($command);
|
||||||
for (0..(($maxname - length($name) + 17) - (length($command) - length($name) + 1))) { $output->write(" "); }
|
$output->write(" " x (($maxname - length($name) + 17) - (length($command) - length($name) + 1)));
|
||||||
if(ref($value) ne "HASH") {
|
if(!defined $parser) {
|
||||||
if($value) {
|
if($value) {
|
||||||
$output->write("Disable ");
|
$output->write("Disable ");
|
||||||
} else {
|
} else {
|
||||||
$output->write("Enable ");
|
$output->write("Enable ");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if(ref($value) eq "HASH")
|
||||||
|
{
|
||||||
if ($value->{active}) {
|
if ($value->{active}) {
|
||||||
$output->write("(Disable) ");
|
$output->write("(Disable) ");
|
||||||
} else {
|
} else {
|
||||||
$output->write("Enable ");
|
$output->write("Enable ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($default == $current) {
|
|
||||||
$output->write("$description\n");
|
|
||||||
}
|
}
|
||||||
|
$output->write("$description\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue