Semantic Diff

#9266 Drop the build system's clap-era argument rewriting

2 commits

d47adb3c80c634706f86888b76b26431d3746250..pr-9266

0247e6fd2 · cknitt + Claude · Nov 08, 2026, 18:06 UTC

Require the command before options in the build system's CLI

Why

normalize_argv rewrote argv so that Rust-era forms (a bare folder, options before the command, -h/-V clusters) kept working on Cmdliner. Its help/version precedence dropped positional words, so an unknown command followed by --help or --version printed help or the version and exited with 0. Only -h and -V remain as aliases now.

modifiedDiagnostic unknown command with a display flag

text
Before
After
$ rescript invalid --help$ rescript invalid --helpNAME rescript - Fast, Simple, Fully Typed JavaScript from the Future…exit 0Usage: rescript [--help] [COMMAND] …rescript: unknown command invalid. Must be one of build, clean, compiler-args, format, help or watchexit 2

modifiedDiagnostic options before the command

text
Before
After
$ rescript -v build$ rescript -v build(builds the current folder with debug output) Usage: rescript [--help] [COMMAND] …rescript: options go after the command: rescript build [OPTION]… (write ./build for a folder named build)exit 2

modifiedDiagnostic bare folder

text
Before
After
$ rescript ./pkg$ rescript ./pkg(builds ./pkg) rescript: unknown command ./pkg. Must be one of build, clean, …exit 2

Review

  • Why reject in the default term instead of scanning argv? Options such as -f take a value, so a scan cannot tell -f build from -v build; Cmdliner has already parsed the options when the default term sees a folder named like a command.
3a9a1d265 · cknitt + Claude · Nov 08, 2026, 18:13 UTC

Match unknown commands in the CLI test whether or not colors are on

CI forces colors, and Cmdliner then quotes the command name instead of styling it, so the test checks the message and the name separately.