Skip to content

feat(cli)!: Scope project/workspace yargs options per command#1434

Open
matz3 wants to merge 1 commit into
mainfrom
refactor/scope-cli-options
Open

feat(cli)!: Scope project/workspace yargs options per command#1434
matz3 wants to merge 1 commit into
mainfrom
refactor/scope-cli-options

Conversation

@matz3

@matz3 matz3 commented Jun 25, 2026

Copy link
Copy Markdown
Member

The yargs options --config / -c, --dependency-definition, --workspace-config,
and --workspace / -w were previously registered globally in base.js and shown
in --help for every command. Several commands silently ignored them:

  • ui5 config / init / versions did not load a project at all
  • ui5 add / remove / use only operate on ui5.yaml without workspace context

Move the option definitions into a new options.js helper module that exposes
applyProjectConfigOptions() and applyWorkspaceOptions(). Each command builder
now opts in to the option groups it actually consumes, and yargs' existing
strict mode rejects the options on commands that no longer accept them.

The shared last-value-wins dedupe coerce is exported as dedupeArray() so
commands can apply it to their own non-global options (framework-version,
dest, port, etc.) instead of relying on a central coerce list in base.js
that referenced options yargs only sees per-command.

BREAKING CHANGE: ui5 versions, ui5 init, and ui5 config no longer accept
--config, --dependency-definition, --workspace, or --workspace-config.
ui5 add, ui5 remove, and ui5 use no longer accept --workspace or
--workspace-config. Passing any of these to a command that does not
support them now fails with 'Unknown argument: '.

The yargs options --config / -c, --dependency-definition, --workspace-config,
and --workspace / -w were previously registered globally in base.js and shown
in --help for every command. Several commands silently ignored them:

  * ui5 config / init / versions did not load a project at all
  * ui5 add / remove / use only operate on ui5.yaml without workspace context

Move the option definitions into a new options.js helper module that exposes
applyProjectConfigOptions() and applyWorkspaceOptions(). Each command builder
now opts in to the option groups it actually consumes, and yargs' existing
strict mode rejects the options on commands that no longer accept them.

The shared last-value-wins dedupe coerce is exported as dedupeArray() so
commands can apply it to their own non-global options (framework-version,
dest, port, etc.) instead of relying on a central coerce list in base.js
that referenced options yargs only sees per-command.

BREAKING CHANGE: ui5 versions, ui5 init, and ui5 config no longer accept
--config, --dependency-definition, --workspace, or --workspace-config.
ui5 add, ui5 remove, and ui5 use no longer accept --workspace or
--workspace-config. Passing any of these to a command that does not
support them now fails with 'Unknown argument: <option>'.
@matz3 matz3 requested review from a team June 25, 2026 10:35
@RandomByte

Copy link
Copy Markdown
Member

Regarding the commit message, it might be worth explicitly stating that the no longer accepted arguments already didn't have any effect in the past

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