mirror of
https://github.com/nushell/nushell
synced 2024-12-28 14:03:09 +00:00
Fix confusing unnamed column and crash
This commit is contained in:
parent
4eafb22d5b
commit
a4a1588fbc
2 changed files with 14 additions and 6 deletions
|
@ -60,11 +60,19 @@ pub fn get_column_path(
|
||||||
|
|
||||||
possible_matches.sort();
|
possible_matches.sort();
|
||||||
|
|
||||||
return Err(ShellError::labeled_error(
|
if possible_matches.len() > 0 {
|
||||||
"Unknown column",
|
return Err(ShellError::labeled_error(
|
||||||
format!("did you mean '{}'?", possible_matches[0].1),
|
"Unknown column",
|
||||||
tag_for_tagged_list(path.iter().map(|p| p.tag())),
|
format!("did you mean '{}'?", possible_matches[0].1),
|
||||||
));
|
tag_for_tagged_list(path.iter().map(|p| p.tag())),
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
return Err(ShellError::labeled_error(
|
||||||
|
"Unknown column",
|
||||||
|
"row does not contain this column",
|
||||||
|
tag_for_tagged_list(path.iter().map(|p| p.tag())),
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ impl TableView {
|
||||||
let mut headers = TableView::merge_descriptors(values);
|
let mut headers = TableView::merge_descriptors(values);
|
||||||
|
|
||||||
if headers.len() == 0 {
|
if headers.len() == 0 {
|
||||||
headers.push("value".to_string());
|
headers.push("<unknown>".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut entries = vec![];
|
let mut entries = vec![];
|
||||||
|
|
Loading…
Reference in a new issue