From a2996abd4767a719ce70589bd6d520f097d417f3 Mon Sep 17 00:00:00 2001 From: JT Date: Sat, 25 Sep 2021 20:58:02 +1200 Subject: [PATCH] improve table for lists --- crates/nu-command/src/table.rs | 12 ++++++++---- crates/nu-protocol/src/value/mod.rs | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/crates/nu-command/src/table.rs b/crates/nu-command/src/table.rs index 45109cec3f..25914f6e22 100644 --- a/crates/nu-command/src/table.rs +++ b/crates/nu-command/src/table.rs @@ -74,10 +74,14 @@ fn convert_to_table(iter: impl IntoIterator) -> Option" { + 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()), diff --git a/crates/nu-protocol/src/value/mod.rs b/crates/nu-protocol/src/value/mod.rs index bdb31de395..f27dc45bbc 100644 --- a/crates/nu-protocol/src/value/mod.rs +++ b/crates/nu-protocol/src/value/mod.rs @@ -290,7 +290,7 @@ impl Value { pub fn columns(&self) -> Vec { match self { Value::Record { cols, .. } => cols.clone(), - _ => vec![], + _ => vec!["".into()], } } }