forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.d.ts
66 lines (64 loc) · 3.03 KB
/
cli.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Type definitions for cli v0.11.2
// Project: https://www.npmjs.com/package/cli
// Definitions by: Klaus Reimer <https://github.com/kayahr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "cli" {
interface CLI {
app: string;
version: string;
argv: string[];
argc: number;
options: any;
args: string[];
command: string;
width: number;
option_width: number;
native: any;
output(message?: any, ...optionalParams: any[]): void;
exit(code: number): void;
no_color: boolean;
enable(...plugins: string[]): CLI;
disable(...plugins: string[]): CLI;
setArgv(argv: string | Array<any>, keepArg0?: boolean): void;
next(): string;
parse(opts?: { [long: string]: { 0: string | boolean, 1: string, 2?: string, 3?: any } },
commands?: { [name: string]: string } | string[]): any;
autocompleteCommand(command: string): string;
info(msg: string): void;
error(msg: string): void;
ok(msg: string): void;
debug(msg: string): void;
fatal(msg: string): void;
setApp(appName: string, version: string): CLI;
setApp(packageJson: string): CLI;
parsePackageJson(path?: string): void;
setUsage(usage: string): CLI;
getUsage(code?: number): void;
getOptError(expects: string, type: string): string;
getValue(defaultVal: string, validateFunc: (value: any) => any, errMsg: string): void;
getInt(defaultVal: number): number;
getDate(defaultVal: Date): Date;
getFloat(defaultVal: number): number;
getUrl(defautltVal: string, identifier?: string): string;
getEmail(defaultVal: string): string;
getIp(defaultVal: string): string;
getPath(defaultVal: string, identifier?: string): string;
getArrayValue<T>(arr: T[], defaultVal: T): T;
withStdin(callback: (data: string) => void): void;
withStdin(encoding: string, callback: (text: string) => void): void;
withStdinLines(callback: (lines: string[], newline: string) => void): void;
withInput(file: string, encoding: string, callback: (line: string, newline: string, eof: boolean) => void): void;
withInput(file: string, callback: (line: string, newline: string, eof: boolean) => void): void;
withInput(callback: (line: string, newline: string, eof: boolean) => void): void;
toType(object: any): string;
daemon(arg: string, callback: () => void): void;
main(callback: (args: string[], options: any) => void): void;
createServer(...args: any[]): any;
exec(cmd: string, callback?: (lines: string[]) => void, errback?: (err: any, stdout: string) => void): void;
progress(progress: number, decimals?: number, stream?: NodeJS.WritableStream): void;
spinner(prefix?: string | boolean, end?: boolean, stream?: NodeJS.WritableStream): void;
}
const cli: CLI;
export = cli;
}