feat: add command-level constraint framework @W-20534184@#1580
feat: add command-level constraint framework @W-20534184@#1580
Conversation
|
Git2Gus App is installed but the |
11fa9fd to
3f7bad4
Compare
318aab5 to
3dc8757
Compare
| // istanbul ignore if - should be unreachable | ||
| if (this.condition) { | ||
| throw new Error('FILLER: DUPLICATE CONDITION') | ||
| } |
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()})
There was a problem hiding this comment.
In theory this should be unreachable, but yeah, can't hurt to have a specific message here.
| const opts = { | ||
| context: this, | ||
| ...options, | ||
| constraints: options.constraints, |
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
}
There was a problem hiding this comment.
Oh, good catch. I'll remove the constraints declaration here. It serves no purpose.
| * Declare a set of flags to be evaluated as one instead of separately. | ||
| * | ||
| * @example | ||
| * flag('foo').is.dependentOn(combinationOf('bar', 'baz)) |
|
QA notes: ✅ : mutuallyExclusive — |
This PR is the implementation of a syntax for command-level constraints. It will close #1507 when it is finally merged.
@W-20534184@