Interface OptionConfig<T, TAlias>

The configuration interface for an option used to define how an option will be parsed and validated.

interface OptionConfig<T, TAlias> {
    alias?: MaybeReadonly<TAlias[]>;
    conflicts?: MaybeReadonly<string[]>;
    default?: MaybeReadonly<OptionPrimitiveType<T>>;
    description?: string;
    nargs?: number;
    required?: boolean;
    requires?: MaybeReadonly<string[]>;
    string?: boolean;
    type: T;
}

Type Parameters

Properties

alias?: MaybeReadonly<TAlias[]>

One or more aliases for the option (optional).

conflicts?: MaybeReadonly<string[]>

Other options that are mutually exclusive with this option (optional).

default?: MaybeReadonly<OptionPrimitiveType<T>>

The default value to use. This will be the initial value that the getter prompt will show (optional).

description?: string

The description of the option (optional, has default based on name).

nargs?: number

The number of arguments the option accepts (optional).

required?: boolean

Prompts the user for the option if it's not present and requires the user enters a valid value. If no prompt field is provided, a default will be used based on name.

requires?: MaybeReadonly<string[]>

Other options that are required for this option to be used (optional).

string?: boolean

Whether the option is a string (optional, inferred from type). Useful for array options to specify the type of the array values.

type: T

The type of the option.