X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=blobdiff_plain;f=src%2FPVE%2FRESTHandler.pm;h=0b8b81c6d740854c72e5b42fc2709de513b786d3;hp=3b9511419ceccc3dbb81d15812b4fb2798ec73b4;hb=32f8e0c75bab20a363192f5bd5d0b7037fd7f918;hpb=c8e5d28e29a932a3729ec3396a0081080041c866 diff --git a/src/PVE/RESTHandler.pm b/src/PVE/RESTHandler.pm index 3b95114..0b8b81c 100644 --- a/src/PVE/RESTHandler.pm +++ b/src/PVE/RESTHandler.pm @@ -418,6 +418,11 @@ my $get_property_description = sub { my $descr = $phash->{description} || "no description available"; + if ($phash->{verbose_description} && + ($style eq 'config' || $style eq 'config-sub')) { + $descr = $phash->{verbose_description}; + } + chomp $descr; my $type = PVE::JSONSchema::schema_get_type_text($phash); @@ -439,6 +444,8 @@ my $get_property_description = sub { if ($style eq 'config') { $res .= "`$name`: "; + } elsif ($style eq 'config-sub') { + $res .= "`$name`="; } elsif ($style eq 'arg') { $res .= "`-$name` "; } elsif ($style eq 'fixed') { @@ -452,9 +459,14 @@ my $get_property_description = sub { if (defined(my $dv = $phash->{default})) { $res .= "(default=`$dv`)"; } - $res .= "::\n\n"; - my $wdescr = Text::Wrap::wrap('', '', ($descr)); + if ($style eq 'config-sub') { + $res .= ";;\n\n"; + } else { + $res .= "::\n\n"; + } + + my $wdescr = $descr; chomp $wdescr; $wdescr =~ s/^$/+/mg; @@ -629,8 +641,7 @@ sub dump_properties { my $phash = $prop->{$k}; next if defined($filterFn) && &$filterFn($k, $phash); - - my $type = $phash->{type} || 'string'; + next if $phash->{alias}; my $base = $k; if ($k =~ m/^([a-z]+)(\d+)$/) { @@ -643,6 +654,20 @@ sub dump_properties { } $raw .= &$get_property_description($base, $style, $phash, $format, 0); + + next if $style ne 'config'; + + my $prop_fmt = $phash->{format}; + next if !$prop_fmt; + + if (ref($prop_fmt) ne 'HASH') { + $prop_fmt = PVE::JSONSchema::get_format($prop_fmt); + } + + next if !(ref($prop_fmt) && (ref($prop_fmt) eq 'HASH')); + + $raw .= dump_properties($prop_fmt, $format, 'config-sub') + } return $raw;