@flowscripter/dynamic-cli-framework
    Preparing search index...

    Interface GlobalCommandArgument

    Interface to be implemented by a single Argument defined by a GlobalCommand.

    interface GlobalCommandArgument {
        allowableValues?: readonly ArgumentSingleValueType[];
        configurationKey?: string;
        defaultValue?: ArgumentSingleValueType;
        isCaseInsensitive?: boolean;
        isOptional?: boolean;
        maxValueInclusive?: number;
        minValueInclusive?: number;
        type: ArgumentValueTypeName;
        validate?: (
            value: ArgumentValues | ArgumentValues[] | ArgumentValueType,
        ) => string | undefined;
    }

    Hierarchy (View Summary)

    Index
    allowableValues?: readonly ArgumentSingleValueType[]

    Optional list of values that the value must match. This is not supported for ArgumentValueTypeName.BOOLEAN.

    configurationKey?: string

    Optional 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:

    • name: FooBar => configuration key: FOOBAR
    • name: Hello-World- => configuration key: HELLO_WORLD_
    • name: 3 => configuration key: _3

    NOTE: 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.

    Default value for the argument if not specified.

    isCaseInsensitive?: boolean

    Optional (default is false) for ArgumentValueTypeName.STRING when comparing a value against allowableValues.

    isOptional?: boolean

    If this is true the argument does not need to be specified nor have a default value. The default is false.

    maxValueInclusive?: number

    Optional for ArgumentValueTypeName.INTEGER or ArgumentValueTypeName.NUMBER when validating a value.

    minValueInclusive?: number

    Optional for ArgumentValueTypeName.INTEGER or ArgumentValueTypeName.NUMBER when validating a value.

    Type of the argument value.

    validate?: (
        value: ArgumentValues | ArgumentValues[] | ArgumentValueType,
    ) => string | undefined

    Optional custom validation function invoked after all built-in validation has passed. Receives the validated and type-converted value.

    Return undefined if the value is valid, or a string describing the validation error. The error string is associated with InvalidArgumentReason.CUSTOM_VALIDATION.

    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;
    }