Skip to content

refactor(cli): share ops argument parsing - #1407

Merged
yyjeqhc merged 1 commit into
mainfrom
codex/simplify-ops-cli-parsing
Nov 9, 2026
Merged

yyjeqhc merged 1 commit into
mainfrom
codex/simplify-ops-cli-parsing

Conversation

@swjnxyf

@swjnxyf swjnxyf commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

The seven ops subcommands repeated help/error handling, and five parsers independently maintained the same eight common flags. Route these through two private helpers so common connection, credential, and output options have one parsing implementation. Common-option validation now returns Result<(), String> instead of cloning the options.

Command-specific parsing and validation remain local. The change preserves defaults, last-value-wins behavior, flag-like values, first-position help handling, error precedence, exit codes, and credential redaction. Production code decreases by 92 lines; table-driven coverage expands across all seven subcommands.

Validation:

  • cargo test --locked -p webcodex-cli --lib tests::ops -- --quiet: 45 tests passed before the change; 46 passed in the final tree, including the existing HTTP/credential and provider-diagnostic tests.
  • Before/after comparison of 44,800 generated argv cases: complete parsed actions and help/error outputs were byte-identical. The temporary comparison probe was removed after validation; focused table-driven regressions remain.
  • cargo fmt -p webcodex-cli -- --check and git diff --check passed.

@yyjeqhc
yyjeqhc merged commit 818e710 into main Nov 9, 2026
19 checks passed
@yyjeqhc
yyjeqhc deleted the codex/simplify-ops-cli-parsing branch November 9, 2026 10:16
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.

2 participants