mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-30 01:03:32 +00:00
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"
|
regex = "1.5"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
textwrap = "0.11"
|
textwrap = "0.15"
|
||||||
|
|
||||||
# the upid type needs this for 'getpid'
|
# the upid type needs this for 'getpid'
|
||||||
libc = { version = "0.2", optional = true }
|
libc = { version = "0.2", optional = true }
|
||||||
|
@ -37,11 +37,11 @@ pub fn wrap_text(
|
|||||||
text: &str,
|
text: &str,
|
||||||
columns: usize,
|
columns: usize,
|
||||||
) -> String {
|
) -> String {
|
||||||
let wrapper1 = textwrap::Wrapper::new(columns)
|
let wrap_options1 = textwrap::Options::new(columns)
|
||||||
.initial_indent(initial_indent)
|
.initial_indent(initial_indent)
|
||||||
.subsequent_indent(subsequent_indent);
|
.subsequent_indent(subsequent_indent);
|
||||||
|
|
||||||
let wrapper2 = textwrap::Wrapper::new(columns)
|
let wrap_options2 = textwrap::Options::new(columns)
|
||||||
.initial_indent(subsequent_indent)
|
.initial_indent(subsequent_indent)
|
||||||
.subsequent_indent(subsequent_indent);
|
.subsequent_indent(subsequent_indent);
|
||||||
|
|
||||||
@ -50,9 +50,9 @@ pub fn wrap_text(
|
|||||||
.filter(|p| !p.is_empty())
|
.filter(|p| !p.is_empty())
|
||||||
.fold(String::new(), |mut acc, p| {
|
.fold(String::new(), |mut acc, p| {
|
||||||
if acc.is_empty() {
|
if acc.is_empty() {
|
||||||
acc.push_str(&wrapper1.wrap(p).join("\n"));
|
acc.push_str(&textwrap::wrap(p, &wrap_options1).join("\n"));
|
||||||
} else {
|
} 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.push_str("\n\n");
|
||||||
acc
|
acc
|
||||||
|
Loading…
Reference in New Issue
Block a user