forked from extern/nushell
Merge pull request #822 from jonathandturner/fix_707
Fix confusing unnamed column and crash
This commit is contained in:
commit
473b6f727c
@ -60,11 +60,19 @@ pub fn get_column_path(
|
||||
|
||||
possible_matches.sort();
|
||||
|
||||
return Err(ShellError::labeled_error(
|
||||
"Unknown column",
|
||||
format!("did you mean '{}'?", possible_matches[0].1),
|
||||
tag_for_tagged_list(path.iter().map(|p| p.tag())),
|
||||
));
|
||||
if possible_matches.len() > 0 {
|
||||
return Err(ShellError::labeled_error(
|
||||
"Unknown column",
|
||||
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);
|
||||
|
||||
if headers.len() == 0 {
|
||||
headers.push("value".to_string());
|
||||
headers.push("<unknown>".to_string());
|
||||
}
|
||||
|
||||
let mut entries = vec![];
|
||||
|
Loading…
Reference in New Issue
Block a user