Skip to content

Centralize CLI argument parsing and reject surplus positionals - #226

Merged
Widthdom merged 1 commit into
mainfrom
agent/centralize-cli-parser-213
Jul 24, 2026
Merged

Centralize CLI argument parsing and reject surplus positionals#226
Widthdom merged 1 commit into
mainfrom
agent/centralize-cli-parser-213

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Closes #213

What changed

  • Parse options, option values, and positional arguments in one CliParser.Parse() pass.
  • Store OldFolder, NewFolder, and optional ReportLabel in the structured CliOptions result.
  • Replace the 35-field positional CliOptions constructor with named properties and defaults.
  • Reject a fourth positional argument with usage information and exit code 2.
  • Preserve two- and three-positional invocations, supported option placement, automatic report labels, wizard execution, and --creator behavior.
  • Update the English/Japanese user guide and changelog.

Root cause

Flag parsing, option-value skipping, positional extraction, validation, and consumption were split between CliParser, RunPreflightValidator, and ProgramRunner. The second positional scan collected every non-option token while ProgramRunner consumed only the first three, so surplus positional arguments disappeared silently. The positional CliOptions constructor also made option additions order-dependent.

User impact

Valid commands continue to work, including:

nildiff oldfolder newfolder --creator
nildiff oldfolder newfolder reportlabel --creator --no-il-cache --coffee

A fourth positional argument now produces usage information and exits with code 2 instead of being ignored.

Validation

  • dotnet build FolderDiffIL4DotNet.sln --nologo — passed with 0 warnings and 0 errors.
  • Focused CLI/parser/validator/wizard/override tests — 120 passed, 0 failed.
  • Release suite — 2019 passed and 1 real-disassembler E2E test skipped; 3 Git-fixture tests initially failed because the local global Git config required an SSH signing-key passphrase.
  • Those 3 Git-fixture tests were rerun from the Release test assembly with commit.gpgsign=false — 3 passed, 0 failed.
  • git diff --check — passed.
  • Final cdidx status --check --json — fresh and complete, with 0 failed checks.

@Widthdom
Widthdom marked this pull request as ready for review July 24, 2026 17:49
@Widthdom
Widthdom merged commit b0046cc into main Jul 24, 2026
8 checks passed
@Widthdom
Widthdom deleted the agent/centralize-cli-parser-213 branch July 26, 2026 06:54
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.

Centralize CLI argument parsing and reject surplus positional arguments

1 participant