passing one param less to the helper methods
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
}
my $print_bash_completion = sub {
}
my $print_bash_completion = sub {
- my ($cmddef, $simple_cmd, $bash_command, $cur, $prev) = @_;
+ my ($simple_cmd, $bash_command, $cur, $prev) = @_;
no strict 'refs';
my $def = ${"${class}::cmddef"};
no strict 'refs';
my $def = ${"${class}::cmddef"};
if (ref($def) eq 'ARRAY') {
print_simple_asciidoc_synopsis(@$def);
} else {
if (ref($def) eq 'ARRAY') {
print_simple_asciidoc_synopsis(@$def);
} else {
$cmddef->{help} = [ __PACKAGE__, 'help', ['cmd'] ];
print_asciidoc_synopsis();
$cmddef->{help} = [ __PACKAGE__, 'help', ['cmd'] ];
print_asciidoc_synopsis();
- my ($def, $cmdname, $cmd, $args, $pwcallback, $preparefunc, $stringfilemap) = @_;
-
- $cmddef = $def;
- $exename = $cmdname;
+ my ($args, $pwcallback, $preparefunc, $stringfilemap) = @_;
$cmddef->{help} = [ __PACKAGE__, 'help', ['cmd'] ];
# call verifyapi before setup_environment(), because we do not want to
# execute any real code in this case
$cmddef->{help} = [ __PACKAGE__, 'help', ['cmd'] ];
# call verifyapi before setup_environment(), because we do not want to
# execute any real code in this case
+ my $cmd = shift @$args;
if (!$cmd) {
print_usage_short (\*STDERR, "no command specified");
exit (-1);
if (!$cmd) {
print_usage_short (\*STDERR, "no command specified");
exit (-1);
$cli_handler_class->setup_environment();
if ($cmd eq 'bashcomplete') {
$cli_handler_class->setup_environment();
if ($cmd eq 'bashcomplete') {
- &$print_bash_completion($cmddef, 0, @$args);
+ &$print_bash_completion(undef, @$args);
};
my $handle_simple_cmd = sub {
};
my $handle_simple_cmd = sub {
- my ($def, $args, $pwcallback, $preparefunc, $stringfilemap) = @_;
+ my ($args, $pwcallback, $preparefunc, $stringfilemap) = @_;
- my ($class, $name, $arg_param, $uri_param, $outsub) = @{$def};
+ my ($class, $name, $arg_param, $uri_param, $outsub) = @{$cmddef};
die "no class specified" if !$class;
if (scalar(@$args) >= 1) {
die "no class specified" if !$class;
if (scalar(@$args) >= 1) {
if (scalar(@$args) >= 1) {
if ($args->[0] eq 'bashcomplete') {
shift @$args;
if (scalar(@$args) >= 1) {
if ($args->[0] eq 'bashcomplete') {
shift @$args;
- &$print_bash_completion({ $name => $def }, $name, @$args);
+ &$print_bash_completion($name, @$args);
initlog($exename);
no strict 'refs';
initlog($exename);
no strict 'refs';
- my $def = ${"${class}::cmddef"};
+ $cmddef = ${"${class}::cmddef"};
- if (ref($def) eq 'ARRAY') {
- &$handle_simple_cmd($def, \@ARGV, $pwcallback, $preparefunc, $stringfilemap);
+ if (ref($cmddef) eq 'ARRAY') {
+ &$handle_simple_cmd(\@ARGV, $pwcallback, $preparefunc, $stringfilemap);
- $cmddef = $def;
- my $cmd = shift @ARGV;
- &$handle_cmd($cmddef, $exename, $cmd, \@ARGV, $pwcallback, $preparefunc, $stringfilemap);
+ &$handle_cmd(\@ARGV, $pwcallback, $preparefunc, $stringfilemap);