forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yargs.d.ts
126 lines (94 loc) · 3.95 KB
/
yargs.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Type definitions for yargs
// Project: https://github.com/chevex/yargs
// Definitions by: Martin Poelstra <https://github.com/poelstra>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "yargs" {
module yargs {
interface Argv {
argv: any;
(...args: any[]): any;
parse(...args: any[]): any;
alias(shortName: string, longName: string): Argv;
alias(aliases: { [shortName: string]: string }): Argv;
alias(aliases: { [shortName: string]: string[] }): Argv;
default(key: string, value: any): Argv;
default(defaults: { [key: string]: any}): Argv;
demand(key: string, msg: string): Argv;
demand(key: string, required?: boolean): Argv;
demand(keys: string[], msg: string): Argv;
demand(keys: string[], required?: boolean): Argv;
demand(positionals: number, required?: boolean): Argv;
demand(positionals: number, msg: string): Argv;
require(key: string, msg: string): Argv;
require(key: string, required: boolean): Argv;
require(keys: number[], msg: string): Argv;
require(keys: number[], required: boolean): Argv;
require(positionals: number, required: boolean): Argv;
require(positionals: number, msg: string): Argv;
required(key: string, msg: string): Argv;
required(key: string, required: boolean): Argv;
required(keys: number[], msg: string): Argv;
required(keys: number[], required: boolean): Argv;
required(positionals: number, required: boolean): Argv;
required(positionals: number, msg: string): Argv;
requiresArg(key: string): Argv;
requiresArg(keys: string[]): Argv;
describe(key: string, description: string): Argv;
describe(descriptions: { [key: string]: string }): Argv;
option(key: string, options: Options): Argv;
option(options: { [key: string]: Options }): Argv;
options(key: string, options: Options): Argv;
options(options: { [key: string]: Options }): Argv;
usage(message: string, options?: { [key: string]: Options }): Argv;
usage(options?: { [key: string]: Options }): Argv;
command(command: string, description: string): Argv;
command(command: string, description: string, fn: (args: Argv) => void): Argv;
completion(cmd: string, fn?: SyncCompletionFunction): Argv;
completion(cmd: string, description?: string, fn?: SyncCompletionFunction): Argv;
completion(cmd: string, fn?: AsyncCompletionFunction): Argv;
completion(cmd: string, description?: string, fn?: AsyncCompletionFunction): Argv;
example(command: string, description: string): Argv;
check(func: (argv: any, aliases: { [alias: string]: string }) => any): Argv;
boolean(key: string): Argv;
boolean(keys: string[]): Argv;
string(key: string): Argv;
string(keys: string[]): Argv;
config(key: string): Argv;
config(keys: string[]): Argv;
wrap(columns: number): Argv;
strict(): Argv;
help(): string;
help(option: string, description?: string): Argv;
version(version: string, option?: string, description?: string): Argv;
showHelpOnFail(enable: boolean, message?: string): Argv;
showHelp(func?: (message: string) => any): Argv;
/* Undocumented */
normalize(key: string): Argv;
normalize(keys: string[]): Argv;
implies(key: string, value: string): Argv;
implies(implies: { [key: string]: string }): Argv;
count(key: string): Argv;
count(keys: string[]): Argv;
fail(func: (msg: string) => any): void;
}
interface Options {
type?: string;
alias?: any;
demand?: any;
required?: any;
require?: any;
default?: any;
boolean?: any;
string?: any;
count?: any;
describe?: any;
description?: any;
desc?: any;
requiresArg?: any;
}
type SyncCompletionFunction = (current: string, argv: any) => string[];
type AsyncCompletionFunction = (current: string, argv: any, done: (completion: string[]) => void) => void;
}
var yargs: yargs.Argv;
export = yargs;
}