+# format option, display type and description
+# $k: option name
+# $display_name: for example "-$k" of "<$k>", pass undef to use "$k:"
+# $phash: json schema property hash
+# $format: 'asciidoc' or 'pod'
+my $get_property_description = sub {
+ my ($k, $display_name, $phash, $format, $hidepw) = @_;
+
+ my $res = '';
+
+ $format = 'asciidoc' if !defined($format);
+
+ my $descr = $phash->{description} || "no description available";
+
+ chomp $descr;
+
+ my $type = PVE::PodParser::schema_get_type_text($phash);
+
+ if ($hidepw && $k eq 'password') {
+ $type = '';
+ }
+
+ if ($format eq 'asciidoc') {
+
+ if (defined($display_name)) {
+ $res .= "`$display_name` ";
+ } else {
+ $res .= "`$k:` ";
+ }
+
+ $res .= "`$type` " if $type;
+
+ if (defined(my $dv = $phash->{default})) {
+ $res .= "(default=`$dv`)";
+ }
+ $res .= "::\n\n";
+ $res .= Text::Wrap::wrap('', '', ($descr)) . "\n";
+
+ if (my $req = $phash->{requires}) {
+ my $tmp .= ref($req) ? join(', ', @$req) : $req;
+ $res .= "+\nNOTE: Requires option(s): `$tmp`\n";
+ }
+ $res .= "\n";
+
+ } elsif ($format eq 'pod') {
+
+ my $defaulttxt = '';
+ if (defined(my $dv = $phash->{default})) {
+ $defaulttxt = " (default=$dv)";
+ }
+
+ $display_name = "$k:" if !defined($display_name);
+
+ my $tmp = sprintf " %-10s %s$defaulttxt\n", $display_name, "$type";
+ my $indend = " ";
+
+ $res .= Text::Wrap::wrap('', $indend, ($tmp));
+ $res .= "\n",
+ $res .= Text::Wrap::wrap($indend, $indend, ($descr)) . "\n\n";
+
+ if (my $req = $phash->{requires}) {
+ my $tmp = "Requires option(s): ";
+ $tmp .= ref($req) ? join(', ', @$req) : $req;
+ $res .= Text::Wrap::wrap($indend, $indend, ($tmp)). "\n\n";
+ }
+
+ } else {
+ die "unknown format '$format'";
+ }
+
+ return $res;
+};
+