ConstraintBuilder
Build relationships using the names declared on a command.
- Import:
@kjanat/dreamcli - Export kind: interface
- Declared in:
src/core/schema/constraints.ts - Source link:
src/core/schema/constraints.ts:49
Signatures
ts
interface ConstraintBuilder<F extends string, A extends string> {}Members
Methods
flag
Reference a flag explicitly when a positional argument has the same name.
ts
flag<N extends F>(name: N): { kind: "flag"; name: N; };arg
Reference a positional argument explicitly.
ts
arg<N extends A>(name: N): { kind: "arg"; name: N; };conflicts
Disallow supplying both inputs.
ts
conflicts(left: InputName<F, A>, right: InputName<F, A>): CommandConstraint;requires
Require the second input when the first is supplied.
ts
requires(input: InputName<F, A>, dependency: InputName<F, A>): CommandConstraint;exactlyOne
Require exactly one of the inputs.
ts
exactlyOne(...inputs: [InputName<F, A>, InputName<F, A>, ...InputName<F, A>[]]): CommandConstraint;atMostOne
Allow at most one of the inputs.
ts
atMostOne(...inputs: [InputName<F, A>, InputName<F, A>, ...InputName<F, A>[]]): CommandConstraint;allOrNone
Require every member when any member is supplied.
ts
allOrNone(...inputs: [InputName<F, A>, InputName<F, A>, ...InputName<F, A>[]]): CommandConstraint;