Commit Graph

1 Commits

Author SHA1 Message Date
moguangyu5-design
1a1d7aa45e fix(scripts): make clawlog default behavior match documented usage (#104059)
* fix(scripts): make clawlog default behavior match documented usage

Running scripts/clawlog.sh with no arguments was printing the usage help
instead of the documented default behavior (last 50 lines from the past 5
minutes). Remove the early no-args help branch so the defaults are used.

Also validate that options requiring a value (-n, -l, -c, -s, -o) actually
receive one, preventing an unbound-variable abort under set -u.

Fixes #104058

* fix(scripts): preserve dash-prefixed operands in clawlog and add regression tests

ClawSweeper review feedback on #104059 noted that the missing-value
guards introduced in the previous commit also rejected valid operands
beginning with a dash (e.g., search text '-failed' or an output file
named '-debug.log'). Narrow the guards so they only reject genuinely
missing operands, not dash-prefixed values.

Add focused regression coverage in test/scripts/clawlog.test.ts for:
- no-argument default behavior
- missing values for -n/-l/-c/-s/-o
- acceptance of dash-prefixed operands
- --help still printing usage

Related: #104058

* test(scripts): isolate clawlog command execution

* test(clawlog): use managed temp directories

---------

Co-authored-by: moguangyu5-design <moguangyu5-design@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-07-12 07:44:25 +08:00