UNPKG

1.92 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 }
37 interface Option {
38 type: 'option';
39 name: string;
40 required?: boolean;
41 char?: string;
42 hidden?: boolean;
43 description?: string;
44 helpValue?: string;
45 default?: string;
46 options?: string[];
47 }
48 }
49 interface Base {
50 _base: string;
51 id: string;
52 hidden: boolean;
53 aliases: string[];
54 description?: string;
55 usage?: string | string[];
56 examples?: string[];
57 }
58 interface Class extends Base {
59 plugin?: Config.IPlugin;
60 flags?: Parser.flags.Input<any>;
61 args?: Parser.args.Input;
62 new (argv: string[], config: Config.IConfig): Instance;
63 run(argv: string[], config?: Config.LoadOptions): Promise<any>;
64 }
65 interface Instance {
66 _run(argv: string[]): Promise<any>;
67 }
68 interface Plugin extends Command {
69 load(): Class;
70 }
71 function toCached(c: Class, plugin?: Config.Plugin): Command;
72}