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