UNPKG

2.02 kBTypeScriptView Raw
1import * as Parser from '@oclif/parser';
2import * as Config from '.';
3export interface Command {
4 id: string;
5 hidden: boolean;
6 aliases: string[];
7 description?: string;
8 usage?: string | string[];
9 examples?: string[];
10 type?: string;
11 pluginName?: string;
12 pluginType?: string;
13 flags: {
14 [name: string]: Command.Flag;
15 };
16 args: Command.Arg[];
17}
18export declare namespace Command {
19 interface Arg {
20 name: string;
21 description?: string;
22 required?: boolean;
23 hidden?: boolean;
24 default?: string;
25 options?: string[];
26 }
27 type Flag = Flag.Boolean | Flag.Option;
28 namespace Flag {
29 interface Boolean {
30 type: 'boolean';
31 name: string;
32 required?: boolean;
33 char?: string;
34 hidden?: boolean;
35 description?: string;
36 helpLabel?: string;
37 allowNo?: boolean;
38 }
39 interface Option {
40 type: 'option';
41 name: string;
42 required?: boolean;
43 char?: string;
44 hidden?: boolean;
45 description?: string;
46 helpLabel?: string;
47 helpValue?: string;
48 default?: string;
49 options?: string[];
50 }
51 }
52 interface Base {
53 _base: string;
54 id: string;
55 hidden: boolean;
56 aliases: string[];
57 description?: string;
58 usage?: string | string[];
59 examples?: string[];
60 }
61 interface Class extends Base {
62 plugin?: Config.IPlugin;
63 flags?: Parser.flags.Input<any>;
64 args?: Parser.args.Input;
65 new (argv: string[], config: Config.IConfig): Instance;
66 run(argv?: string[], config?: Config.LoadOptions): PromiseLike<any>;
67 }
68 interface Instance {
69 _run(argv: string[]): Promise<any>;
70 }
71 interface Plugin extends Command {
72 load(): Class;
73 }
74 function toCached(c: Class, plugin?: Config.Plugin): Command;
75}