mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 21:37:54 +02:00
Fallback internally to String primitives until Member int serialization lands.
This commit is contained in:
@ -82,21 +82,36 @@ pub fn get_column_path(
|
||||
_ => {}
|
||||
}
|
||||
|
||||
match did_you_mean(&obj_source, &column_path_tried) {
|
||||
Some(suggestions) => {
|
||||
match &column_path_tried {
|
||||
Tagged {
|
||||
item: Value::Primitive(Primitive::Int(index)),
|
||||
..
|
||||
} => {
|
||||
return ShellError::labeled_error(
|
||||
"Unknown column",
|
||||
format!("did you mean '{}'?", suggestions[0].1),
|
||||
tag_for_tagged_list(fields.iter().map(|p| p.tag())),
|
||||
)
|
||||
}
|
||||
None => {
|
||||
return ShellError::labeled_error(
|
||||
"Unknown column",
|
||||
"row does not contain this column",
|
||||
tag_for_tagged_list(fields.iter().map(|p| p.tag())),
|
||||
"No rows available",
|
||||
format!(
|
||||
"Not a table. Perhaps you meant to get the column '{}' instead?",
|
||||
index
|
||||
),
|
||||
column_path_tried.tag(),
|
||||
)
|
||||
}
|
||||
_ => match did_you_mean(&obj_source, &column_path_tried) {
|
||||
Some(suggestions) => {
|
||||
return ShellError::labeled_error(
|
||||
"Unknown column",
|
||||
format!("did you mean '{}'?", suggestions[0].1),
|
||||
tag_for_tagged_list(fields.iter().map(|p| p.tag())),
|
||||
)
|
||||
}
|
||||
None => {
|
||||
return ShellError::labeled_error(
|
||||
"Unknown column",
|
||||
"row does not contain this column",
|
||||
tag_for_tagged_list(fields.iter().map(|p| p.tag())),
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
Reference in New Issue
Block a user