schema: property description: output indentation where its required

The wrap_text helper accepts and initial indentation, so use that as
central point to add the indentation that glues the list entry
together with its description.

Mostly a small optimization, should not matter in practice, i.e. where
all properties should have a description.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2024-10-22 14:51:04 +02:00
parent bd1133fcd2
commit 1c4467841d

View File

@ -270,22 +270,22 @@ pub fn get_property_description(
let mut text = match style {
ParameterDisplayStyle::Config => {
// reST definition list format
format!("``{name}`` : ``{type_text}{default_text}``\n ")
format!("``{name}`` : ``{type_text}{default_text}``\n")
}
ParameterDisplayStyle::ConfigSub => {
// reST definition list format
format!("``{name}`` = ``{type_text}{default_text}``\n ")
format!("``{name}`` = ``{type_text}{default_text}``\n")
}
ParameterDisplayStyle::Arg => {
// reST option list format
format!("``--{name}`` ``{type_text}{default_text}``\n ")
format!("``--{name}`` ``{type_text}{default_text}``\n")
}
ParameterDisplayStyle::Fixed => {
format!("``<{name}>`` : ``{type_text}{default_text}``\n ")
format!("``<{name}>`` : ``{type_text}{default_text}``\n")
}
};
text.push_str(&wrap_text("", " ", &descr, 80));
text.push_str(&wrap_text(" ", " ", &descr, 80));
text
} else {