pvesh usage: new option --returns to print result schema
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
This commit is contained in:
parent
35ea1f7fab
commit
4012507fd7
10
bin/pvesh
10
bin/pvesh
@ -347,6 +347,11 @@ __PACKAGE__->register_method ({
|
|||||||
type => 'boolean',
|
type => 'boolean',
|
||||||
optional => 1,
|
optional => 1,
|
||||||
},
|
},
|
||||||
|
returns => {
|
||||||
|
description => "Including schema for returned data.",
|
||||||
|
type => 'boolean',
|
||||||
|
optional => 1,
|
||||||
|
},
|
||||||
command => {
|
command => {
|
||||||
description => "API command.",
|
description => "API command.",
|
||||||
type => 'string',
|
type => 'string',
|
||||||
@ -374,10 +379,15 @@ __PACKAGE__->register_method ({
|
|||||||
if ($param->{verbose}) {
|
if ($param->{verbose}) {
|
||||||
print $handler->usage_str(
|
print $handler->usage_str(
|
||||||
$info->{name}, "pvesh $cmd $path", undef, {}, 'full');
|
$info->{name}, "pvesh $cmd $path", undef, {}, 'full');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
print "USAGE: " . $handler->usage_str(
|
print "USAGE: " . $handler->usage_str(
|
||||||
$info->{name}, "pvesh $cmd $path", undef, {}, 'short');
|
$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) {
|
if (!$found) {
|
||||||
|
Loading…
Reference in New Issue
Block a user