mirror of
git://git.proxmox.com/git/pve-common.git
synced 2025-01-10 09:17:37 +03:00
introcude new output format 'yaml'
This commit is contained in:
parent
b01a09e73f
commit
ac6c61bf13
@ -389,7 +389,9 @@ sub print_api_result {
|
||||
|
||||
return if $result_schema->{type} eq 'null';
|
||||
|
||||
if ($format eq 'json') {
|
||||
if ($format eq 'yaml') {
|
||||
print encode('UTF-8', CPAN::Meta::YAML::Dump($data));
|
||||
} elsif ($format eq 'json') {
|
||||
# Note: we always use utf8 encoding for json format
|
||||
print to_json($data, {utf8 => 1, allow_nonref => 1, canonical => 1 }) . "\n";
|
||||
} elsif ($format eq 'json-pretty') {
|
||||
|
@ -108,7 +108,7 @@ register_standard_option('fingerprint-sha256', {
|
||||
register_standard_option('pve-output-format', {
|
||||
type => 'string',
|
||||
description => 'Output format.',
|
||||
enum => [ 'text', 'json', 'json-pretty' ],
|
||||
enum => [ 'text', 'json', 'json-pretty', 'yaml' ],
|
||||
optional => 1,
|
||||
default => 'text',
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user