forked from Proxmox/proxmox
schema: update to textwrap 0.15
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
1344ffdd94
commit
1349f24d49
@ -14,7 +14,7 @@ lazy_static = "1.4"
|
||||
regex = "1.5"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
textwrap = "0.11"
|
||||
textwrap = "0.15"
|
||||
|
||||
# the upid type needs this for 'getpid'
|
||||
libc = { version = "0.2", optional = true }
|
||||
|
@ -37,11 +37,11 @@ pub fn wrap_text(
|
||||
text: &str,
|
||||
columns: usize,
|
||||
) -> String {
|
||||
let wrapper1 = textwrap::Wrapper::new(columns)
|
||||
let wrap_options1 = textwrap::Options::new(columns)
|
||||
.initial_indent(initial_indent)
|
||||
.subsequent_indent(subsequent_indent);
|
||||
|
||||
let wrapper2 = textwrap::Wrapper::new(columns)
|
||||
let wrap_options2 = textwrap::Options::new(columns)
|
||||
.initial_indent(subsequent_indent)
|
||||
.subsequent_indent(subsequent_indent);
|
||||
|
||||
@ -50,9 +50,9 @@ pub fn wrap_text(
|
||||
.filter(|p| !p.is_empty())
|
||||
.fold(String::new(), |mut acc, p| {
|
||||
if acc.is_empty() {
|
||||
acc.push_str(&wrapper1.wrap(p).join("\n"));
|
||||
acc.push_str(&textwrap::wrap(p, &wrap_options1).join("\n"));
|
||||
} else {
|
||||
acc.push_str(&wrapper2.wrap(p).join("\n"));
|
||||
acc.push_str(&textwrap::wrap(p, &wrap_options2).join("\n"));
|
||||
}
|
||||
acc.push_str("\n\n");
|
||||
acc
|
||||
|
Loading…
Reference in New Issue
Block a user