You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6b58ac0
Browse filesBrowse the repository at this point in the historyBrowse files
Drop the build system's clap-era argument rewriting (#9266)
* 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.
Diagnostic modified (unknown command with a display flag):
Before (text):
$ rescript invalid --help
NAME
rescript - Fast, Simple, Fully Typed JavaScript from the Future
…
exit 0
After (text):
$ rescript invalid --help
Usage: rescript [--help] [COMMAND] …
rescript: unknown command invalid. Must be one of build, clean,
compiler-args, format, help or watch
exit 2
Diagnostic modified (options before the command):
Before (text):
$ rescript -v build
(builds the current folder with debug output)
After (text):
$ rescript -v build
Usage: rescript [--help] [COMMAND] …
rescript: options go after the command: rescript build [OPTION]… (write
./build for a folder named build)
exit 2
Diagnostic modified (bare folder):
Before (text):
$ rescript ./pkg
(builds ./pkg)
After (text):
$ rescript ./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.
Breaking: `rescript <folder>` becomes `rescript build <folder>`, options go after the command (`rescript build -v`), and -h/-V no longer combine with other flags in one cluster.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLt5FhNDjMw2sNude8
Signed-off-by: Christoph Knittel <ck@cca.io>
* 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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kbf3gLt5FhNDjMw2sNude8
Signed-off-by: Christoph Knittel <ck@cca.io>
---------
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
-`rescript` needs the command before its options and folder, as in `rescript build -v ./pkg`, and reports an unknown command even when `--help` or `--version` follows it.
0 commit comments