Semantic Diff

#9264 Fix exit status for unknown CLI commands with help

2 commits

827be160cce2386954ea3cf27d3c106540cb2bf6..pr-9264

413e8bd46 · aspeddro · Nov 07, 2026, 17:50 UTC

Reject unknown CLI commands when help is requested

Why

Argument normalization discarded unknown command names when help was requested, so misspelled commands printed root help and exited with 0.

modifiedRepresentation Cli.normalize_argv routing

text
Before
After
rescript invalid --help -> rescript --help=plainrescript invalid --help -> rescript help invalid

modifiedDiagnostic unknown command help

text
Before
After
rescript invalid --helprescript invalid --helpRoot help on stdout; exit status 0. rescript: unknown command "invalid"Exit status 2.
6be17f530 · aspeddro · Nov 07, 2026, 18:09 UTC

Reject unknown CLI commands when version is requested

Why

The help fix still let version requests discard unknown subcommands and exit successfully. Validate command topics for both display flags.

modifiedRepresentation Cli.normalize_argv routing

text
Before
After
rescript unkdnow --version -> rescript --versionrescript unkdnow --version -> rescript help unkdnow

modifiedDiagnostic unknown command version

text
Before
After
rescript unkdnow --versionrescript unkdnow --versionrescript 13.0.0-alpha.8Exit status 0.rescript: unknown command "unkdnow"Exit status 2.