Skip to content

fix(scope): a positional project ID overrides the saved scope, like --project-id - #281

Open
krls2020 wants to merge 1 commit into
mainfrom
fix-positional-project
Open

krls2020 wants to merge 1 commit into
mainfrom
fix-positional-project

Conversation

@krls2020

Copy link
Copy Markdown
Contributor

Intent: a project ID you type should always win over the saved project scope. The scope is only a default for when you don't give an ID. --project-id and service IDs already work like that.

Problem: a project ID given as a positional argument was ignored whenever a scope was set, and zcli silently used the scoped project instead. A regression from the refactor in caad899.

With zcli scope project A set:

Command Before After
zcli project delete B deletes A deletes B
zcli service list B lists services of A lists services of B
zcli vpn up B connects to A connects to B
zcli vpn config B configures A configures B

Nothing changes without a scope, or when the ID is passed with --project-id.

A test checks that project delete deletes the right project. It fails on main and passes with this fix. The other commands use the same shared code.

With a project scope saved, a positional project id was ignored because it was applied only when no project was selected yet, so the scope won.
An explicit id, flag or positional, is now resolved before the saved scope, and the flag wins when both are given.
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.

4 participants