Repository navigation
CLI: dataset release --version X.Y.Z reaches the release command - #1653
bruAristimunha wants to merge 1 commit into
Conversation
The root program's '-v, --version' is recognised anywhere on the command
line, so 'nemar dataset release <id> --version 2.0.0' -- the form the
release help documents -- printed the CLI version and exited 0, and a
scripted release (-y) silently did nothing. The '=' form already worked
because the root option is boolean.
Before parsing, bindShadowedOptionValues joins a value-taking option of the
addressed subcommand to its value when an ancestor command declares the
same flag ('--version 2.0.0' -> '--version=2.0.0'). Global flags keep
working anywhere (no enablePositionalOptions); a bare '--version', values
that look like flags, anything after '--', and boolean collisions (nemarOrg#1220)
are left alone.
|
Thank you for this fix, and for the entry-point test that ran the real CLI. It is merged into the integration branch for epic #1671 as PR #1673, with your commit kept (4a647d0 on that branch, authored by you). The review added commits on top, so this PR is closed in favor of that one. What the review added: a shadowed option given with no value, or an empty one, is now a usage error instead of the root printing the CLI version (and an empty The epic merges into |
Problem
#1493: the root program's
-v, --version(src/index.ts) is recognised anywhere on the command line, sonemar dataset release <id> --version 2.0.0, the form the release help documents, printed the CLI version and exited 0, and a scripted release (-y) silently did nothing. The=form already worked.Change
bindShadowedOptionValues(program, argv)runs beforeparseAsync. For the subcommand named on the line, a value-taking option whose flag an ancestor also declares is joined to its value (--version 2.0.0→--version=2.0.0).enablePositionalOptions), a bare--version, values that start with-, anything after--, and boolean collisions such as-v/--verbose(Subcommand -v/--verbose shadowed by root -v (version) and global --verbose #1220 stays open).Closes #1493
Testing
test/release-version-flag.test.ts(new, 6 tests), including an entry-point test that runs the real CLI: onmainit prints the CLI version and exits 0; on this branch it reaches the release command.Files that import the changed modules (
src/index.tspulls in most of the CLI), on currentdev: CLI 18 files, 751 pass, 19 skip, 1 fail; backend 25 files, 1027 pass, 0 fail. The one failure isneurobagel-node-deploy.unit.test.ts"the symlink swap is one rename" (10 s timeout on this laptop); this branch does not touch that file and it fails the same way onmain.bun run typecheck,biome checkon the changed files.CI
api-testandintegration-devfail on this PR because it comes from a fork: both call the dev API with theTEST_*_API_KEYsecrets, which GitHub does not pass to fork pull requests, so the authenticated cases fail and the unauthenticated ones pass.lint,unit-pureande2e-sandboxrun normally.