Interface ParseOptions<TBooleans, TStrings, TCollectable, TNegatable, TDefault, TAliases, TDoubleDash>
--?: TDoubleDash;
alias?: TAliases;
boolean?: TBooleans | readonly Extract<TBooleans, string>[];
collect?: TCollectable | readonly Extract<TCollectable, string>[];
default?: TDefault & Id<UnionToIntersection<Record<string, unknown> & MapTypes<TStrings, unknown, undefined> & MapTypes<TBooleans, unknown, undefined> & Partial<Record<TBooleans extends string
? TBooleans<TBooleans>
: string, unknown>> & Partial<Record<TStrings extends string
? TStrings<TStrings>
: string, unknown>>>>;
negatable?: TNegatable | readonly Extract<TNegatable, string>[];
stopEarly?: boolean;
string?: TStrings | readonly Extract<TStrings, string>[];
unknown?: ((arg: string, key?: string, value?: unknown) => unknown);
}
Type Parameters
- TBooleans extends BooleanType = BooleanType
- TStrings extends StringType = StringType
- TCollectable extends Collectable = Collectable
- TNegatable extends Negatable = Negatable
- TDefault extends Record<string, unknown> | undefined = Record<string, unknown> | undefined
- TAliases extends Aliases | undefined = Aliases | undefined
- TDoubleDash extends boolean | undefined = boolean | undefined
Index
Properties
Properties
Optional--
When true, populate the result _ with everything before the -- and
the result ['--'] with everything after the --.
Optionalalias
An object mapping string names to strings or arrays of string argument names to use as aliases.
Optionalboolean
A boolean, string or array of strings to always treat as booleans. If
true will treat all double hyphenated arguments without equal signs as
boolean (e.g. affects --foo, not -f or --foo=bar).
All boolean arguments will be set to false by default.
Optionalcollect
A string or array of strings argument names to always treat as arrays. Collectable options can be used multiple times. All values will be collected into one array. If a non-collectable option is used multiple times, the last value is used.
Optionaldefault
? TBooleans<TBooleans>
: string, unknown>> & Partial<Record<TStrings extends string
? TStrings<TStrings>
: string, unknown>>>>
An object mapping string argument names to default values.
Optionalnegatable
A string or array of strings argument names which can be negated
by prefixing them with --no-, like --no-config.
OptionalstopEarly
When true, populate the result _ with everything after the first
non-option.
Optionalstring
A string or array of strings argument names to always treat as strings.
Optionalunknown
A function which is invoked with a command line parameter not defined in
the options configuration object. If the function returns false, the
unknown option is not added to parsedArgs.
Options for
parseArgs.