mirror of
https://github.com/nushell/nushell
synced 2025-01-01 15:58:55 +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()];
|
||||
|
||||
for header in headers.iter().skip(1) {
|
||||
let result = item.clone().follow_cell_path(&[PathMember::String {
|
||||
val: header.into(),
|
||||
span: Span::unknown(),
|
||||
}]);
|
||||
let result = if header == "<value>" {
|
||||
Ok(item.clone())
|
||||
} else {
|
||||
item.clone().follow_cell_path(&[PathMember::String {
|
||||
val: header.into(),
|
||||
span: Span::unknown(),
|
||||
}])
|
||||
};
|
||||
|
||||
match result {
|
||||
Ok(value) => row.push(value.into_string()),
|
||||
|
|
|
@ -290,7 +290,7 @@ impl Value {
|
|||
pub fn columns(&self) -> Vec<String> {
|
||||
match self {
|
||||
Value::Record { cols, .. } => cols.clone(),
|
||||
_ => vec![],
|
||||
_ => vec!["<value>".into()],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue