mirror of
https://github.com/nushell/nushell.git
synced 2025-08-14 03:18:29 +02:00
feat(table): make missing value symbol configurable (#15647)
Co-authored-by: Bahex <17417311+Bahex@users.noreply.github.com>
This commit is contained in:
@ -340,6 +340,7 @@ pub struct TableConfig {
|
||||
pub header_on_separator: bool,
|
||||
pub abbreviated_row_count: Option<usize>,
|
||||
pub footer_inheritance: bool,
|
||||
pub missing_value_symbol: String,
|
||||
}
|
||||
|
||||
impl IntoValue for TableConfig {
|
||||
@ -358,6 +359,7 @@ impl IntoValue for TableConfig {
|
||||
"header_on_separator" => self.header_on_separator.into_value(span),
|
||||
"abbreviated_row_count" => abbv_count,
|
||||
"footer_inheritance" => self.footer_inheritance.into_value(span),
|
||||
"missing_value_symbol" => self.missing_value_symbol.into_value(span),
|
||||
}
|
||||
.into_value(span)
|
||||
}
|
||||
@ -374,6 +376,7 @@ impl Default for TableConfig {
|
||||
padding: TableIndent::default(),
|
||||
abbreviated_row_count: None,
|
||||
footer_inheritance: false,
|
||||
missing_value_symbol: "❎".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -411,6 +414,10 @@ impl UpdateFromValue for TableConfig {
|
||||
_ => errors.type_mismatch(path, Type::custom("int or nothing"), val),
|
||||
},
|
||||
"footer_inheritance" => self.footer_inheritance.update(val, path, errors),
|
||||
"missing_value_symbol" => match val.as_str() {
|
||||
Ok(val) => self.missing_value_symbol = val.to_string(),
|
||||
Err(_) => errors.type_mismatch(path, Type::String, val),
|
||||
},
|
||||
_ => errors.unknown_option(path, val),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user