[pve-devel] [pve-common 3/4] pvesh usage: correctly handle uri paramaeters, cleanups

Dietmar Maurer dietmar at proxmox.com
Wed Jul 11 11:19:44 CEST 2018


Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 bin/pvesh | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/bin/pvesh b/bin/pvesh
index b1b3be89..7c6e44a0 100755
--- 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 ],
-- 
2.11.0




More information about the pve-devel mailing list