nu-table: Don't show empty header (#6035)

Signed-off-by: Maxim Zhiburt <zhiburt@gmail.com>
This commit is contained in:
Maxim Zhiburt
2022-07-13 14:43:39 +03:00
committed by GitHub
parent ad9449bf00
commit f2a79cf381
2 changed files with 14 additions and 14 deletions

View File

@ -19,9 +19,9 @@ use crate::{
#[derive(Debug)]
pub struct Table {
pub headers: Option<Vec<StyledString>>,
pub data: Vec<Vec<StyledString>>,
pub theme: TableTheme,
headers: Option<Vec<StyledString>>,
data: Vec<Vec<StyledString>>,
theme: TableTheme,
}
impl Table {
@ -30,6 +30,11 @@ impl Table {
data: Vec<Vec<StyledString>>,
theme: TableTheme,
) -> Table {
let headers = match headers {
Some(headers) if headers.is_empty() => None,
headers => headers,
};
Table {
headers,
data,