X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=src%2FPVE%2FCLIFormatter.pm;fp=src%2FPVE%2FCLIFormatter.pm;h=f9eb03fe4f3f3b7b94aa286df22c5d1b81cf9ae3;hp=8bb42ca15e044fa1e899a0398c15ea3fe74d1164;hb=ba752c806222675c4d94c6253e2720cd8d81b881;hpb=2e2a45027220fb291bb9a3c8cd304907ac76d9c2 diff --git a/src/PVE/CLIFormatter.pm b/src/PVE/CLIFormatter.pm index 8bb42ca..f9eb03f 100644 --- a/src/PVE/CLIFormatter.pm +++ b/src/PVE/CLIFormatter.pm @@ -4,6 +4,7 @@ use strict; use warnings; use I18N::Langinfo; use POSIX qw(strftime); +use CPAN::Meta::YAML; # comes with perl-modules use PVE::JSONSchema; use PVE::PTY; @@ -81,6 +82,17 @@ sub render_bytes { PVE::JSONSchema::register_renderer('bytes', \&render_bytes); +sub render_yaml { + my ($value) = @_; + + my $data = CPAN::Meta::YAML::Dump($value); + $data =~ s/^---[\n\s]//; # remove yaml marker + + return $data; +} + +PVE::JSONSchema::register_renderer('yaml', \&render_yaml); + sub query_terminal_options { my ($options) = @_;