1 |
|
2 | import { EventEmitter } from 'events';
|
3 | import Command, { HelpCallback, CommandExample } from './Command';
|
4 | import { OptionConfig } from './Option';
|
5 | interface ParsedArgv {
|
6 | args: string[];
|
7 | options: {
|
8 | [k: string]: any;
|
9 | };
|
10 | }
|
11 | declare class CAC extends EventEmitter {
|
12 | bin: string;
|
13 | commands: Command[];
|
14 | globalCommand: Command;
|
15 | matchedCommand: Command;
|
16 | |
17 |
|
18 |
|
19 | rawArgs: string[];
|
20 | |
21 |
|
22 |
|
23 | args: string[];
|
24 | |
25 |
|
26 |
|
27 | options: {
|
28 | [k: string]: any;
|
29 | };
|
30 | constructor();
|
31 | usage(text: string): this;
|
32 | command(rawName: string, description: string): Command;
|
33 | option(rawName: string, description: string, config?: OptionConfig): this;
|
34 | help(callback?: HelpCallback): this;
|
35 | version(version: string, customFlags?: string): this;
|
36 | /**
|
37 | * Add a global example
|
38 | * @param example
|
39 | */
|
40 | example(example: CommandExample): this;
|
41 | outputHelp(subCommand?: boolean): this;
|
42 | outputVersion(): this;
|
43 | parse(argv?: string[]): ParsedArgv;
|
44 | private minimist;
|
45 | private runCommandAction;
|
46 | }
|
47 | declare const cac: () => CAC;
|
48 | export = cac;
|