Support Cargo scaffolding and human output, and find boolean expressions
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user