feat: support the 'combinable' & 'only' flag relationships#1487
Merged
mdonnalley merged 1 commit intooclif:mdonnalley/1487from Oct 20, 2025
Merged
feat: support the 'combinable' & 'only' flag relationships#1487mdonnalley merged 1 commit intooclif:mdonnalley/1487from
mdonnalley merged 1 commit intooclif:mdonnalley/1487from
Conversation
This new flag relationship aims to ease defining that a specific flag is ONLY compatible with just a few other ones. Currently users would have to enumerate all other incompatible flags in the exclusive relationship, which leads to some repetition, doesn't capture exactly the original intention, and could lead to oversights if more flags are added to that command later. I realized this use case while working on a balena-cli PR, where we had to define that --config is allowed to be combined with the --yes flag and is incompatible with all other flags. The workaround that we ended up having to use, was to use an IIFE and define the compatible flags in a separate array and reference that in the exclusive property. balena-io/balena-cli@692e70d
|
This issue has been linked to a new work item: W-19992287 |
mdonnalley
approved these changes
Oct 20, 2025
Contributor
|
@thgreasi Just tested this out and it works great! Thanks for making the change I'll merge this into a separate feature branch so that integration tests can run. Once those pass, I'll merge to main |
Contributor
Author
|
Thanks for the instant review @mdonnalley 🙏 |
mdonnalley
added a commit
that referenced
this pull request
Oct 20, 2025
…1488) This new flag relationship aims to ease defining that a specific flag is ONLY compatible with just a few other ones. Currently users would have to enumerate all other incompatible flags in the exclusive relationship, which leads to some repetition, doesn't capture exactly the original intention, and could lead to oversights if more flags are added to that command later. I realized this use case while working on a balena-cli PR, where we had to define that --config is allowed to be combined with the --yes flag and is incompatible with all other flags. The workaround that we ended up having to use, was to use an IIFE and define the compatible flags in a separate array and reference that in the exclusive property. balena-io/balena-cli@692e70d Co-authored-by: Thodoris Greasidis <thgreasi@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This new flag relationship aims to ease defining that a specific flag is ONLY compatible with just a few other ones.
Currently users would have to enumerate all other incompatible flags in the exclusive relationship, which leads to some repetition, doesn't capture exactly the original intention, and could lead to oversights if more flags are added to that command later. I realized this use case while working on a balena-cli PR, where we had to define that
--config is allowed to be combined with the --yes flag and is incompatible with all other flags.
The workaround that we ended up having to use, was to use an IIFE and define the compatible flags in a separate array and reference that in the exclusive property. balena-io/balena-cli@692e70d
I'm sure I have missed some pieces like adding proper docs, but thought it would be better to first check whether there would be interest in extending the flag relationships. For sure plz suggest any better name that you can think.