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
This commit is contained in:
2026-06-05 00:19:05 +02:00
parent 409b770ac6
commit fef09d4a47
+3 -1
View File
@@ -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");