Skip to content

fix(cli): reserve -V for ext-str#1032

Open
He-Pin wants to merge 2 commits into
databricks:masterfrom
He-Pin:fix/cli-short-v-ext-str
Open

fix(cli): reserve -V for ext-str#1032
He-Pin wants to merge 2 commits into
databricks:masterfrom
He-Pin:fix/cli-short-v-ext-str

Conversation

@He-Pin

@He-Pin He-Pin commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Motivation

-V was registered as a short alias for three different options: --ext-str, --ext-code, and --tla-code. The collision caused nondeterministic behavior depending on argument order. Reference implementations (C++ jsonnet, go-jsonnet, jrsonnet) reserve -V exclusively for --ext-str.

Implementation -V aliases
C++ jsonnet 0.22.0 --ext-str only
go-jsonnet 0.22.0 --ext-str only
jrsonnet 0.5.0-pre99 --ext-str only
sjsonnet master --ext-str, --ext-code, --tla-code (collision)
this PR --ext-str only

Modification

  • Remove short = 'V' from --ext-code and --tla-code @arg annotations in Config.scala.
  • Keep short = 'V' on --ext-str only.
  • Update README help snapshot to reflect the change.
  • Add CLI regression tests using Jsonnet input files plus golden outputs.

Result

  • -V exclusively aliases --ext-str, matching reference implementations.
  • --ext-code and --tla-code remain available through their explicit long options.
  • Zero runtime impact: the change is purely CLI argument definition.

@He-Pin He-Pin force-pushed the fix/cli-short-v-ext-str branch from fc07d8a to 28e593c Compare June 24, 2026 17:57
@He-Pin He-Pin marked this pull request as ready for review June 24, 2026 18:21
Motivation:
Match C++ jsonnet, go-jsonnet, and jrsonnet CLI semantics where -V is the short alias for --ext-str only. The previous sjsonnet definition also attached -V to code-valued and TLA-valued options, making the short option ambiguous and inconsistent with the other implementations.

Modification:
Remove the -V short alias from --ext-code and --tla-code, keep it only on --ext-str, update the README help snapshot, and add CLI regression coverage backed by Jsonnet input files plus golden outputs.

Result:
-V now binds string external variables, while code external variables and top-level code arguments require their explicit long options.
@He-Pin He-Pin force-pushed the fix/cli-short-v-ext-str branch from 28e593c to 1819fa4 Compare June 25, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants