Interface MapDeclarationOption<T>

interface MapDeclarationOption<T> {
    defaultValue: T;
    help: string | ((i18n: TranslationProxy) => string);
    map: Map<string, T> | Record<string | number, T>;
    name: string;
    type: Map;
    configFileOnly?: boolean;
}

Type Parameters

  • T

Hierarchy (view full)

Properties

defaultValue: T

Unlike the rest of the option types, there is no sensible generic default for mapped option types. The default value for a mapped type must be specified.

help: string | ((i18n: TranslationProxy) => string)

The help text to be displayed to the user when --help is passed.

This may be a string, which will be presented directly, or a function, which will be called with an TranslationProxy so that option help can be translated into the user specified locale.

map: Map<string, T> | Record<string | number, T>

Maps a given value to the option type. The map type may be a TypeScript enum. In that case, when generating an error message for a mismatched key, the numeric keys will not be listed.

name: string

The option name.

type: Map

The parameter type, used to convert user configuration values into the expected type. If not set, the type will be a string.

configFileOnly?: boolean

If set, this option will be omitted from --help, and attempting to specify it on the command line will produce an error.