export declare type Description = string | ReadonlyArray; export declare type TableRow = { [left: string]: Description; }; export declare type TableRows = ReadonlyArray; export declare type Table = TableRow | TableRows; export declare type ArgumentType = string | boolean | number; export declare type ValidatorFunction = (value: T, rawValue: string, argument: Argument) => boolean; export declare type Validator = RegExp | ValidatorFunction; export interface DefaultableSingle { multi?: false; default?: T; realDefault?: T; match?: Validator; } export interface DefaultableMulti { multi: true; default?: ReadonlyArray; realDefault?: ReadonlyArray; match?: Validator; } export interface NamedArgument { argumentName?: string; } export declare type ArgumentAsString = { type: 'string'; } & NamedArgument & (DefaultableSingle | DefaultableMulti); export declare type ArgumentAsBoolean = { type: 'boolean'; } & DefaultableSingle; export declare type ArgumentAsNumber = { type: 'number'; } & NamedArgument & (DefaultableSingle | DefaultableMulti); export declare type TypedArgument = ArgumentAsString | ArgumentAsBoolean | ArgumentAsNumber; export interface BaseArgument { /** * The argument name (the long name) */ name: Name; /** * The data type representing this argument */ /** * A multi-argument takes more than one value. It consumes all * non-dash-beginning arguments as values. */ /** * Shortcut (one character) alias of the argument */ alias?: string | ReadonlyArray; /** * Description of the argument (can be multi-lined by providing an array) */ description?: Description; /** * Defines whether the argument is negatable or not (--arg vs --no-arg) * * Defaults to true for boolean arguments and false for other. */ negatable?: boolean; /** * The default-value */ /** * The *real* default-value (not printed in the help section but used * run-time) */ /** * The extra arguments handled by this argument. * * Should be on the form "", "[optional]" or "[multi...]" or a * combination of these. * * Can not be used if are provided */ /** * Hard-coded list of acceptable values and/or values provided to the help * screen. * * By default, values specified cause them to be matched against the input * for validation (which can be over-ruled by ) and will be used to * show the user possible values. * * The keys in this object represent the argument string and the value is * a description of it (as a string or an array of strings). * * Can not be used if are provided */ values?: Table; /** * A list of examples. Each example is an object with a key being the * particular example string, and the value is a description as a string * or array of strings. */ example?: Table; } export declare type Argument = BaseArgument & TypedArgument; export interface Style { color?: string; backgroundColor?: string; } export interface Group extends Style { name: string; } export interface GroupTag extends Group { isGroup: true; } export declare const isArgument: (arg: Argument | GroupTag) => arg is Argument; export declare const isGroup: (arg: GroupTag | T) => arg is GroupTag;