]> git.proxmox.com Git - pve-manager.git/commitdiff
pvesh usage: new option --returns to print result schema
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 11 Jul 2018 09:19:43 +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 a5a9b9fb90409ee0322c9898c6b0e7a053b2d2e8..b1b3be89f2c1a1ad8b7dc15dc383cb5effbb4431 100755 (executable)
--- a/bin/pvesh
+++ b/bin/pvesh
@@ -347,6 +347,11 @@ __PACKAGE__->register_method ({
                type => 'boolean',
                optional => 1,
            },
+           returns => {
+               description => "Including schema for returned data.",
+               type => 'boolean',
+               optional => 1,
+           },
            command => {
                description => "API command.",
                type => 'string',
@@ -374,10 +379,15 @@ __PACKAGE__->register_method ({
            if ($param->{verbose}) {
                print $handler->usage_str(
                    $info->{name}, "pvesh $cmd $path", undef, {}, 'full');
+
            } else {
                print "USAGE: " . $handler->usage_str(
                    $info->{name}, "pvesh $cmd $path", undef, {}, 'short');
            }
+           if ($param-> {returns}) {
+               my $schema = to_json($info->{returns}, {utf8 => 1, canonical => 1, pretty => 1 });
+               print "RETURNS: $schema\n";
+           }
        }
 
        if (!$found) {