UNPKG

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