Repository navigation
CLI: reject blank and stray flag values; report/merge take --x=value - #122
Merged
Merged
Conversation
Flag values go through one walker, so a blank value (--threshold= used to read as 0) and a missing one exit 2 naming the flag, and a flag that takes no value refuses --flag=value (--dry-run=false used to still dry-run). A numeric flag takes a negative number so the range check names it. --width must be a positive integer. A bare --sitemap with a .xml route or origin asks for --sitemap=<it>. report and merge share the walker: --x=value works and a missing value no longer swallows the next flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
--threshold=and--threshold " "used to read as 0, so the run never failed; now they exit 2 with "--threshold needs a value".--width=and--concurrency=say "needs a value" instead of "got 0".--threshold -1gives "expects 0..1, got -1" instead of "needs a value").=valueon flags that take none:--dry-run=false,--progress=false,--computed=false,--no-recheck=xetc. exit 2 with " takes no value".--dry-run=falseused to still dry-run.--width:--width 1.5is rejected at the flag ("--width expects a positive integer"). This matches Config: reject unknown keys, bad widths, non-http origins, blank selectors #120's configwidthscheck.--selector,--left-selectorand--right-selectorare trimmed, and a blank one is rejected, as with--mask/--hide.--sitemapguard: a bare--sitemaptogether with a route or origin ending in.xmlnow says "use --sitemap=". Before, the file silently became a route (or the right origin) while the default sitemap was fetched.--x=valueworks, and a missing value no longer swallows the next flag (--title --markdown fgives "--title needs a value").All parsers now go through one
flags()walker insrc/cli.ts. It replaces the inline split/next()and the per-branch blank checks.Behaviour changes
--accept " "now says "--accept needs a value" (was "needs a reason").report --foo=xsays "unexpected argument: --foo" (the flag name, without=x).-needs the=form:--title=-x.--title -xis rejected.Testing
typecheck, lint, format:check and
npm testpass after the rebase on #120 (388 tests).tests/unit/cli-args.test.ts: blank numerics, fractional width,=valueon boolean flags, the sitemap guard (route and origin forms), a blank selector, and=inside an origin and a route still parsing.tests/unit/report.test.ts:report --markdown=<file>,report --titlewith a missing value,merge --outwith a missing value.🤖 Generated with Claude Code