mirror of
https://github.com/nushell/nushell
synced 2025-01-06 10:19:03 +00:00
improve table for lists
This commit is contained in:
parent
d1da75d315
commit
a2996abd47
2 changed files with 9 additions and 5 deletions
|
@ -74,10 +74,14 @@ fn convert_to_table(iter: impl IntoIterator<Item = Value>) -> Option<nu_table::T
|
||||||
let mut row = vec![row_num.to_string()];
|
let mut row = vec![row_num.to_string()];
|
||||||
|
|
||||||
for header in headers.iter().skip(1) {
|
for header in headers.iter().skip(1) {
|
||||||
let result = item.clone().follow_cell_path(&[PathMember::String {
|
let result = if header == "<value>" {
|
||||||
val: header.into(),
|
Ok(item.clone())
|
||||||
span: Span::unknown(),
|
} else {
|
||||||
}]);
|
item.clone().follow_cell_path(&[PathMember::String {
|
||||||
|
val: header.into(),
|
||||||
|
span: Span::unknown(),
|
||||||
|
}])
|
||||||
|
};
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(value) => row.push(value.into_string()),
|
Ok(value) => row.push(value.into_string()),
|
||||||
|
|
|
@ -290,7 +290,7 @@ impl Value {
|
||||||
pub fn columns(&self) -> Vec<String> {
|
pub fn columns(&self) -> Vec<String> {
|
||||||
match self {
|
match self {
|
||||||
Value::Record { cols, .. } => cols.clone(),
|
Value::Record { cols, .. } => cols.clone(),
|
||||||
_ => vec![],
|
_ => vec!["<value>".into()],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue