Optional ReadonlyallowableOptional list of values that the value must match. This is not supported for ValueTypeName.BOOLEAN.
Optional ReadonlyconfigurationOptional configuration key to use for the argument. Must consist of alphanumeric non-whitespace uppercase
ASCII or _ characters. Must not start with a digit.
If not specified a default configuration key is determined as follows: The SubCommandArgument.name is capitalized
and any - characters are replaced with _ characters. If the result starts with a digit, it is
prefixed with _. Some examples:
FooBar => configuration key: FOOBARHello-World- => configuration key: HELLO_WORLD_3 => configuration key: _3NOTE: Regardless of whether a configurationKey is specified, or the default is relied upon,
it will only be used if the parent Command has specified Command.enableConfiguration as true.
Optional ReadonlydescriptionOptional description of the argument.
Optional ReadonlyisOptional (default is false) for ValueTypeName.STRING when comparing a value against allowableValues.
Optional ReadonlymaxOptional for ValueTypeName.INTEGER or ValueTypeName.NUMBER when validating a value.
Optional ReadonlyminOptional for ValueTypeName.INTEGER or ValueTypeName.NUMBER when validating a value.
ReadonlynameName of the argument.
Must consist of alphanumeric non-whitespace ASCII or _ and - characters. Cannot start with -.
ReadonlytypeType of the argument value.
Optional ReadonlyvalidateOptional custom validation function invoked after all built-in validation has passed. Receives the validated and type-converted value and a ValidationContext giving access to all other provided values of the command. A validator that only needs the value may declare just the first parameter.
Return undefined if the value is valid, or a string describing the
validation error. The error string is associated with
InvalidArgumentReason.CUSTOM_VALIDATION.
Validators declared on properties nested inside ComplexOption.properties are also invoked, at any depth:
properties declaration order. A property's
validator is invoked after the validators of its own child properties, and only if they all
passed. A parent therefore always receives a fully converted and child-validated value.isArray, the validator is invoked once with the whole converted
array. For an array of ComplexOption values, the child property validators are
invoked for each element.defaultValue is validated using the default value. An
absent nested property with isOptional and no default is skipped and its validator is not
invoked.opt.sub[2].field.Example: ensure array values are unique:
validate: (value) => {
const arr = value as string[];
return new Set(arr).size !== arr.length
? "values must be unique"
: undefined;
}
Interface to be implemented by all SubCommand arguments.