Skip to content

Recognize CLI help regardless of argument position - #738

Merged
TheGreatAxios merged 3 commits into
mainfrom
cl-7092-recognize-help-consistently-and-reject-flags-as-option
Sep 1, 2026
Merged

Recognize CLI help regardless of argument position#738
TheGreatAxios merged 3 commits into
mainfrom
cl-7092-recognize-help-consistently-and-reject-flags-as-option

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • CLI help requests are recognized from any argument position before normal option parsing.
  • Value-taking flags reject flag-shaped tokens instead of swallowing --help, -h, or another option as their value.
  • Missing values without a help request keep a clear validation error.

Verification

  • bun run check passes (lint, typecheck, build, full test suite)
  • Parser regression tests cover help after flags, after positionals, immediately after value flags, and resume -h

Fixes CL-7092
Fixes #483

@linear-code

linear-code Bot commented Aug 31, 2026

Copy link
Copy Markdown

CL-7092

Value flags were binding the next token even when it was --help or
another flag. Scan argv for help first, and reject flag-shaped tokens
as required option values.
Value flags now reject --* and -h via isFlagToken instead of every dash-prefixed token, so POSIX paths like --cwd -my-dir still bind.
The previous case passed an absolute path whose last segment was -my-dir, so reverting isFlagToken to startsWith("-") would still pass CI while breaking corbits --cwd -my-dir. Bind the argv token itself and assert cwd is resolve("-my-dir"). Also cover omitted --cwd/--config/--profile.
@TheGreatAxios
TheGreatAxios force-pushed the cl-7092-recognize-help-consistently-and-reject-flags-as-option branch from 980b9cd to 7b55aaa Compare September 1, 2026 04:11
@TheGreatAxios
TheGreatAxios merged commit 7919199 into main Sep 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI --help is ignored except as the first argument, and value flags can swallow it

1 participant