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 buildfrom-v build; Cmdliner has already parsed the options when the default term sees a folder named like a command.