Merge pull request #4060 from dotCooCoo/feat/unknown-command-suggestion

Commands: an unknown command id is answered with the nearest command id
This commit is contained in:
Brandon Thomas
2026-10-25 10:37:54 -04:00
committed by GitHub
29 changed files with 101 additions and 5 deletions
+7 -1
View File
@@ -56,7 +56,13 @@ pub(super) fn action_batch(s: &mut Session, p: &Value) -> Result<Value> {
return Err(bad(C, "batches cannot nest"));
}
if find_command(id).is_none() {
return Err(bad(C, format!("commands[{i}]: unknown command `{id}`")));
return Err(bad(
C,
match super::super::params::nearest_command(id) {
Some(near) => format!("commands[{i}]: unknown command `{id}`; did you mean `{near}`?"),
None => format!("commands[{i}]: unknown command `{id}`"),
},
));
}
}
let source = str_param(p, "source").unwrap_or("folder");