Skip to content

Add -p short alias for --param in luca run - #106

Merged
albertodebortoli merged 1 commit into
mainfrom
shorthand-param
Jul 31, 2026
Merged

Add -p short alias for --param in luca run#106
albertodebortoli merged 1 commit into
mainfrom
shorthand-param

Conversation

@albertodebortoli

@albertodebortoli albertodebortoli commented Jul 31, 2026

Copy link
Copy Markdown
Member

Description

The original ask was to improve the UX of luca run so parameters could be passed without the --param flag at all, e.g.:

luca run build flavour=release upload=true

instead of the current:

luca run build --param flavor=release --param upload=true

We explored a few options before landing on this PR's approach:

  1. Bare key=value positional arguments (the original ask). Implemented as an @Argument array trailing the existing optional <name> argument. This reads naturally, but ArgumentParser fills positional arguments greedily in declaration order: with <name> as an optional scalar positional followed by an array positional, a bare key=value token given while using --file (which is mutually exclusive with <name>) would get wrongly assigned to name instead of to the params array — e.g. luca run --file x.yml flavor=release would set name = "flavor=release". This is a real, silent-failure-shaped edge case, not just a corner case to document away.
  2. Detect-and-reinterpret: keep the bare positional form, but add logic in validate()/run() to notice when name itself looks like KEY=VALUE and --file is set, and reclassify it as a param. This resolves the ambiguity but adds parsing "magic" that's surprising and harder to reason about/test.
  3. Add -p as a short-name alias for --param (chosen). No positional parsing ambiguity, no magic, fully backward compatible with existing scripts/CI using --param. Slightly less terse than the original ask, but a much safer change:
    luca run build -p flavor=release -p upload=true
    

Given the risk profile of option 1/2 versus the low-risk, high-value option 3, we went with the -p alias.

Type of Change

  • Feature
  • Bug fix
  • Maintenance / Refactor
  • Documentation
  • CI / Tooling
  • Other (specify)

How Has This Been Tested?

  • Manually tested locally (swift build, then luca run --file test.yml -p flavor=release -p upload=true --dry-run, verified both params resolved as overrides)
  • Added / updated unit tests (no existing unit test coverage for RunCommand argument parsing; behavior verified manually and via full test suite)
  • Tested on macOS (arch: arm64)
  • Full swift test suite passes (581 tests)

Screenshots / Demo (if applicable)

N/A (CLI flag change)

Checklist

  • Swift code builds locally (swift build)
  • Tests pass locally (swift test)
  • Code style / formatting respected
  • Documentation updated (README / comments)
  • Version / tag alignment considered (if release related)
  • PR title follows conventional style (optional)

CI Considerations

  • Affects build time notably
  • Requires new secrets / env vars
  • Alters release process

Breaking Changes?

  • No
  • Yes (describe impact and migration path)

Additional Notes

--param continues to work exactly as before; -p is purely additive.

Lets `luca run` parameter values be passed more tersely,
e.g. `luca run build -p flavor=release -p upload=true`.
@albertodebortoli albertodebortoli added this to the 0.25.0 milestone Jul 31, 2026
@albertodebortoli albertodebortoli added the feature New feature or enhancement label Jul 31, 2026
@albertodebortoli
albertodebortoli marked this pull request as ready for review July 31, 2026 20:13
@albertodebortoli
albertodebortoli merged commit 06fa246 into main Jul 31, 2026
3 checks passed
@albertodebortoli
albertodebortoli deleted the shorthand-param branch July 31, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant