Follow-up from Codex review on #93 and #91 (P2). Bundling related parser/edge-case issues.
Problem 1 — `clauck history --last 0` traceback
If `--last 0` is passed, `display = summaries[:last]` becomes empty and `max(len(s["name"]) for s in display)` raises `ValueError: max() arg is an empty sequence`, producing a traceback instead of a clean result.
Fix: validate `last >= 1` at parse time (`die("--last must be >= 1")`) OR guard the empty `display` case and print "no matching invocations" cleanly.
Location: `lib/clauck` line ~856.
Problem 2 — `clauck cost --days` (no value) silently defaults to 30
If `--days` is the final argument with no following value, the parser silently removes the flag and falls back to the 30-day default. Misleading report window, hides user input mistakes. Non-integer values already `die("--days requires an integer")`, so missing values should too.
Fix: match the non-integer error path — `die("--days requires an integer")` when no value follows.
Location: `lib/clauck` line ~3534.
Acceptance
- `clauck history --last 0` exits cleanly (either usage error or "no matching invocations" — pick one).
- `clauck cost --days` (no value) exits non-zero with a clear error.
- Tests covering both edge cases.
Follow-up from Codex review on #93 and #91 (P2). Bundling related parser/edge-case issues.
Problem 1 — `clauck history --last 0` traceback
If `--last 0` is passed, `display = summaries[:last]` becomes empty and `max(len(s["name"]) for s in display)` raises `ValueError: max() arg is an empty sequence`, producing a traceback instead of a clean result.
Fix: validate `last >= 1` at parse time (`die("--last must be >= 1")`) OR guard the empty `display` case and print "no matching invocations" cleanly.
Location: `lib/clauck` line ~856.
Problem 2 — `clauck cost --days` (no value) silently defaults to 30
If `--days` is the final argument with no following value, the parser silently removes the flag and falls back to the 30-day default. Misleading report window, hides user input mistakes. Non-integer values already `die("--days requires an integer")`, so missing values should too.
Fix: match the non-integer error path — `die("--days requires an integer")` when no value follows.
Location: `lib/clauck` line ~3534.
Acceptance