TT#68300 Fix programs --help output, do not print missing help parameter

The GetOptions() function will pass «$opt_name, $opt_value» to the
function refs in the options spec, which means that the usage()
function will consider that a missing parameters message and print
"help" as being a missing required parameter.

Use an anonymous function to wrap the usage() call and avoid the
unexpected arguments.

Change-Id: I5c10b241da23ccb7aa25a13dd5ebc1b4188b7370
changes/19/34319/1
Guillem Jover 6 years ago
parent 15070594a5
commit f7019c9139

@ -14,7 +14,7 @@ my $opts = {
};
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"verbose",
) or usage();

@ -16,7 +16,7 @@ my $opts = {
};
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"billing_profile_id=i",
"contact_id=i",
"type=s",

@ -17,7 +17,7 @@ my $opts = {
};
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"domain=s",
"reseller_id=i",
"skip_xmpp",

@ -15,7 +15,7 @@ my $opts = {
};
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"customer_id=i",
"username|u=s",
"password|p=s",

@ -25,7 +25,7 @@ my $opts = {
my $config;
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"verbose",
) or usage();

@ -17,7 +17,7 @@ my $opts = {
};
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"domain=s",
"skip_xmpp",
"skip_sip",

@ -38,7 +38,7 @@ my $opts = {
my $config;
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"verbose",
) or usage();

@ -14,7 +14,7 @@ my $opts = {
};
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"customer_id=i",
"verbose",
) or usage();

@ -14,7 +14,7 @@ my $opts = {
};
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"id=i",
"verbose",
) or usage();

@ -14,7 +14,7 @@ my $opts = {
};
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"customer_id=i",
"verbose",
) or usage();

@ -14,7 +14,7 @@ my $opts = {
};
GetOptions( $opts,
"help|h" => \&usage,
"help|h" => sub { usage() },
"username=s",
"domain=s",
"verbose",

Loading…
Cancel
Save