From fef09d4a473dbecc7259d4458beedd5de47e2bb5 Mon Sep 17 00:00:00 2001 From: Brummel Date: Fri, 5 Jun 2026 00:19:05 +0200 Subject: [PATCH] feat(aura-cli): strict `aura run` arg-parse rejects trailing tokens `aura run` keyed only on the first token being `run`, so `aura run extra-garbage` printed the full report and exited 0 -- a typo'd `aura run --sweep` silently ran instead of hinting. #16 ratified the strict reading over the lenient one (the lenient reading buys no real forward-compat: future args would be parsed explicitly anyway, while the silent-swallow actively hides typos and clashes with the exit-2 hygiene the unknown-subcommand path already enforces). Add a match guard so only a bare `run` reaches the JSON happy path: Some("run") if args.next().is_none() => println!(...) A trailing token fails the guard and falls through to the existing `_ =>` usage-error arm (stderr usage, exit 2) -- no literal duplication, the error path is reused. Bare `aura run` is unchanged, pinned by the positive-preservation assertion and the two sibling run-tests. Verified: cargo test -p aura-cli green (6), clippy --all-targets -D warnings clean. closes #16 --- crates/aura-cli/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/aura-cli/src/main.rs b/crates/aura-cli/src/main.rs index 8e8c66c..9b85f6e 100644 --- a/crates/aura-cli/src/main.rs +++ b/crates/aura-cli/src/main.rs @@ -114,7 +114,9 @@ fn run_sample() -> RunReport { fn main() { let mut args = std::env::args().skip(1); match args.next().as_deref() { - Some("run") => println!("{}", run_sample().to_json()), + // strict: a bare `run` proceeds; a trailing token falls through to the + // usage-error path rather than masquerading as a successful run (#16). + Some("run") if args.next().is_none() => println!("{}", run_sample().to_json()), Some("--help") | Some("-h") => println!("usage: aura run"), _ => { eprintln!("aura: usage: aura run");