Support Cargo scaffolding and human output, and find boolean expressions

This commit is contained in:
2026-11-11 21:57:37 +00:00
parent c7606b8ae9
commit 652ea7960f
7 changed files with 267 additions and 116 deletions
+4 -2
View File
@@ -25,7 +25,7 @@ fn error(value: impl std::fmt::Debug) -> io::Error {
}
fn local_help(argv: &[String]) -> Option<&'static str> {
matches!(argv.first().map(String::as_str), Some("--help" | "-h" | "help")).then_some(
"Usage: cargo <COMMAND> [OPTIONS]\n\nWorld commands: build, check, clippy, test, run, fmt, fetch, add, remove\n",
"Usage: cargo <COMMAND> [OPTIONS]\n\nWorld commands: build, check, clippy, test, run, fmt, fetch, add, remove, new, init\n",
)
}
pub fn run() -> io::Result<i32> {
@@ -123,7 +123,9 @@ fn help_is_local_and_lists_world_commands() {
for flag in ["--help", "-h", "help"] {
let help = local_help(&[flag.into()]).expect("local help");
assert!(help.starts_with("Usage: cargo <COMMAND> [OPTIONS]\n"));
assert!(help.contains("build, check, clippy, test, run, fmt, fetch, add, remove"));
assert!(
help.contains("build, check, clippy, test, run, fmt, fetch, add, remove, new, init")
);
}
assert!(local_help(&["build".into()]).is_none());
assert!(local_help(&[]).is_none());