UNPKG

933 BTypeScriptView Raw
1export declare type ParseFn<T> = (input: string) => T;
2export interface IArg<T = string> {
3 name: string;
4 description?: string;
5 required?: boolean;
6 hidden?: boolean;
7 parse?: ParseFn<T>;
8 default?: T | (() => T);
9 options?: string[];
10}
11export interface ArgBase<T> {
12 name?: string;
13 description?: string;
14 hidden?: boolean;
15 parse: ParseFn<T>;
16 default?: T | (() => T);
17 input?: string;
18 options?: string[];
19}
20export declare type RequiredArg<T> = ArgBase<T> & {
21 required: true;
22 value: T;
23};
24export declare type OptionalArg<T> = ArgBase<T> & {
25 required: false;
26 value?: T;
27};
28export declare type Arg<T> = RequiredArg<T> | OptionalArg<T>;
29export declare function newArg<T>(arg: IArg<T> & {
30 Parse: ParseFn<T>;
31}): Arg<T>;
32export declare function newArg(arg: IArg): Arg<string>;
33export interface Output {
34 [name: string]: any;
35}
36export declare type Input = IArg<any>[];
37
\No newline at end of file