mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-16 09:34:38 +00:00
text_table.rs: add table padding
This commit is contained in:
parent
c1eeaf7612
commit
a5083b9028
@ -130,7 +130,7 @@ impl TableBorders {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _j in 0..*column_width {
|
for _j in 0..*column_width+2 {
|
||||||
if ascii_delimiters {
|
if ascii_delimiters {
|
||||||
top.push('=');
|
top.push('=');
|
||||||
head.push('=');
|
head.push('=');
|
||||||
@ -504,11 +504,13 @@ fn render_table<W: Write>(
|
|||||||
for (i, name) in column_names.iter().enumerate() {
|
for (i, name) in column_names.iter().enumerate() {
|
||||||
let column = &tabledata[i];
|
let column = &tabledata[i];
|
||||||
header.push(borders.column_separator);
|
header.push(borders.column_separator);
|
||||||
|
header.push(' ');
|
||||||
if column.right_align {
|
if column.right_align {
|
||||||
header.push_str(&format!("{:>width$}", name, width = column.width));
|
header.push_str(&format!("{:>width$}", name, width = column.width));
|
||||||
} else {
|
} else {
|
||||||
header.push_str(&format!("{:<width$}", name, width = column.width));
|
header.push_str(&format!("{:<width$}", name, width = column.width));
|
||||||
}
|
}
|
||||||
|
header.push(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if !(options.noheader || options.noborder) {
|
if !(options.noheader || options.noborder) {
|
||||||
@ -538,6 +540,7 @@ fn render_table<W: Write>(
|
|||||||
if i > 0 { text.push(' '); }
|
if i > 0 { text.push(' '); }
|
||||||
} else {
|
} else {
|
||||||
text.push(borders.column_separator);
|
text.push(borders.column_separator);
|
||||||
|
text.push(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
if column.right_align {
|
if column.right_align {
|
||||||
@ -545,6 +548,8 @@ fn render_table<W: Write>(
|
|||||||
} else {
|
} else {
|
||||||
text.push_str(&format!("{:<width$}", line, width = column.width));
|
text.push_str(&format!("{:<width$}", line, width = column.width));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !options.noborder { text.push(' '); }
|
||||||
}
|
}
|
||||||
if !options.noborder { text.push(borders.column_separator); }
|
if !options.noborder { text.push(borders.column_separator); }
|
||||||
write_line(&text)?;
|
write_line(&text)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user