feat: add command-level constraint framework @W-20534184@#1580
Open
jfeingold35 wants to merge 10 commits intomainfrom
Open
feat: add command-level constraint framework @W-20534184@#1580jfeingold35 wants to merge 10 commits intomainfrom
jfeingold35 wants to merge 10 commits intomainfrom
Conversation
|
Git2Gus App is installed but the |
11fa9fd to
3f7bad4
Compare
318aab5 to
3dc8757
Compare
soridalac
reviewed
Apr 27, 2026
| // istanbul ignore if - should be unreachable | ||
| if (this.condition) { | ||
| throw new Error('FILLER: DUPLICATE CONDITION') | ||
| } |
Contributor
There was a problem hiding this comment.
do this need to throw a message instead?
example: throw new Error(Misconfigured constraint: duplicate condition set on ${this.getName()})
Contributor
Author
There was a problem hiding this comment.
In theory this should be unreachable, but yeah, can't hurt to have a specific message here.
soridalac
reviewed
Apr 27, 2026
| const opts = { | ||
| context: this, | ||
| ...options, | ||
| constraints: options.constraints, |
Contributor
There was a problem hiding this comment.
add constraints here is redundant of ...options or is this intentional to override?
in ...options:
export type Input<TFlags extends FlagOutput, BFlags extends FlagOutput, AFlags extends ArgOutput> = {
flags?: FlagInput<TFlags>
baseFlags?: FlagInput<BFlags>
constraints?: Constraint[] | undefined
enableJsonFlag?: true | false
args?: ArgInput<AFlags>
strict?: boolean | undefined
context?: ParserContext
'--'?: boolean
}
Contributor
Author
There was a problem hiding this comment.
Oh, good catch. I'll remove the constraints declaration here. It serves no purpose.
soridalac
reviewed
Apr 27, 2026
| * Declare a set of flags to be evaluated as one instead of separately. | ||
| * | ||
| * @example | ||
| * flag('foo').is.dependentOn(combinationOf('bar', 'baz)) |
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 PR is the implementation of a syntax for command-level constraints. It will close #1507 when it is finally merged.
@W-20534184@