]> git.proxmox.com Git - pve-manager.git/commitdiff
pvesh usage: correctly handle uri paramaeters, cleanups
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 11 Jul 2018 09:19:44 +0000 (11:19 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 11 Jul 2018 09:27:13 +0000 (11:27 +0200)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
bin/pvesh

index b1b3be89f2c1a1ad8b7dc15dc383cb5effbb4431..7c6e44a06efa416d8bb42b9011e2bacd3f00f03d 100755 (executable)
--- a/bin/pvesh
+++ b/bin/pvesh
@@ -364,25 +364,24 @@ __PACKAGE__->register_method ({
     code => sub {
        my ($param) = @_;
 
-       $opt_nooutput = 1; # we print directly
-
        my $path = $param->{api_path};
 
        my $found = 0;
        foreach my $cmd (qw(get set create delete)) {
            next if $param->{command} && $cmd ne $param->{command};
            my $method = $method_map->{$cmd};
-           my ($handler, $info) = PVE::API2->find_handler($method, $path);
+           my $uri_param = {};
+           my ($handler, $info) = PVE::API2->find_handler($method, $path, $uri_param);
            next if !$handler;
            $found = 1;
 
            if ($param->{verbose}) {
                print $handler->usage_str(
-                   $info->{name}, "pvesh $cmd $path", undef, {}, 'full');
+                   $info->{name}, "pvesh $cmd $path", undef, $uri_param, 'full');
 
            } else {
                print "USAGE: " . $handler->usage_str(
-                   $info->{name}, "pvesh $cmd $path", undef, {}, 'short');
+                   $info->{name}, "pvesh $cmd $path", undef, $uri_param, 'short');
            }
            if ($param-> {returns}) {
                my $schema = to_json($info->{returns}, {utf8 => 1, canonical => 1, pretty => 1 });
@@ -402,7 +401,7 @@ __PACKAGE__->register_method ({
     }});
 
 our $cmddef = {
-    usage => [ __PACKAGE__, 'usage', ['api_path'], {}, $format_result ],
+    usage => [ __PACKAGE__, 'usage', ['api_path']],
     get => [ __PACKAGE__, 'get', ['api_path'], {}, $format_result ],
     set => [ __PACKAGE__, 'set', ['api_path'], {}, $format_result ],
     create => [ __PACKAGE__, 'create', ['api_path'], {}, $format_result ],