mirror of
https://github.com/nushell/nushell
synced 2025-01-15 14:44:14 +00:00
Fix list printing (#540)
This commit is contained in:
parent
fc7ed1bfe4
commit
c3a16902fe
1 changed files with 21 additions and 14 deletions
|
@ -264,21 +264,28 @@ fn convert_to_table(
|
||||||
let mut row: Vec<(String, String)> =
|
let mut row: Vec<(String, String)> =
|
||||||
vec![("string".to_string(), (row_num + row_offset).to_string())];
|
vec![("string".to_string(), (row_num + row_offset).to_string())];
|
||||||
|
|
||||||
for header in headers.iter().skip(1) {
|
if headers.is_empty() {
|
||||||
let result = match item {
|
// if header row is empty, this is probably a list so format it that way
|
||||||
Value::Record { .. } => item.clone().follow_cell_path(&[PathMember::String {
|
row.push(("list".to_string(), item.into_abbreviated_string(config)))
|
||||||
val: header.into(),
|
} else {
|
||||||
span: head,
|
for header in headers.iter().skip(1) {
|
||||||
}]),
|
let result = match item {
|
||||||
_ => Ok(item.clone()),
|
Value::Record { .. } => {
|
||||||
};
|
item.clone().follow_cell_path(&[PathMember::String {
|
||||||
|
val: header.into(),
|
||||||
|
span: head,
|
||||||
|
}])
|
||||||
|
}
|
||||||
|
_ => Ok(item.clone()),
|
||||||
|
};
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
Ok(value) => row.push((
|
Ok(value) => row.push((
|
||||||
(&value.get_type()).to_string(),
|
(&value.get_type()).to_string(),
|
||||||
value.into_abbreviated_string(config),
|
value.into_abbreviated_string(config),
|
||||||
)),
|
)),
|
||||||
Err(_) => row.push(("empty".to_string(), "❎".into())),
|
Err(_) => row.push(("empty".to_string(), "❎".into())),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue