CLI snapshot takes --in; an unknown command suggests close ids (#1301)
snapshot starts from --in (a design or STEP file) with the script on top, as run does, and refuses options it doesn't take; an unknown command id names the closest registered ids.
This commit is contained in:
1 parent
50c5c13f72
commit
96356dc544
6 files changed
+149
-24
No files matched your search
@@ -837,6 +837,20 @@ fn only_own_ids_name_commands() {
|
||||
}
|
||||
}
|
||||
|
||||
/// An unknown command's error names the ids it was probably meant to be: a typo's, or the
|
||||
/// command that ends in the same word.
|
||||
#[test]
|
||||
fn unknown_commands_suggest_the_closest_ids() {
|
||||
let mut s = Session::default();
|
||||
let mut msg = |id: &str| s.execute(id, &serde_json::json!({})).unwrap_err().to_string();
|
||||
assert_eq!(msg("file.open"), "unknown command `file.open` (did you mean `doc.open`?)");
|
||||
assert!(msg("solid.extrud").starts_with("unknown command `solid.extrud` (did you mean `solid.extrude`"), "{}", msg("solid.extrud"));
|
||||
assert!(msg("Extrude").contains("`solid.extrude`"), "{}", msg("Extrude"));
|
||||
assert_eq!(msg("FusionFilletEdgesCommand"), "unknown command `FusionFilletEdgesCommand`");
|
||||
let long = "x".repeat(10_000);
|
||||
assert_eq!(msg(&long), format!("unknown command `{long}`"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sample_design_builds() {
|
||||
let mut s = Session::default();
|
||||
|
||||
Reference in new issue
Block a user