forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
argparse.d.ts
90 lines (79 loc) · 2.44 KB
/
argparse.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
// Type definitions for argparse v1.0.3
// Project: https://github.com/nodeca/argparse
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "argparse" {
export class ArgumentParser extends ArgumentGroup {
constructor(options? : ArgumentParserOptions);
addSubparsers(options? : SubparserOptions) : SubParser;
parseArgs(args? : string[], ns? : Namespace|Object) : any;
printUsage() : void;
printHelp() : void;
formatUsage() : string;
formatHelp() : string;
parseKnownArgs(args? : string[], ns? : Namespace|Object) : any[];
convertArgLineToArg(argLine : string) : string[];
exit(status : number, message : string) : void;
error(err : string|Error) : void;
}
interface Namespace {}
class SubParser {
addParser(name : string, options? : SubArgumentParserOptions) : ArgumentParser;
}
class ArgumentGroup {
addArgument(args : string[], options? : ArgumentOptions) : void;
addArgumentGroup(options? : ArgumentGroupOptions) : ArgumentGroup;
addMutuallyExclusiveGroup(options? : {required : boolean}) : ArgumentGroup;
setDefaults(options? : {}) : void;
getDefault(dest : string) : any;
}
interface SubparserOptions {
title? : string;
description? : string;
prog? : string;
parserClass? : {new() : any};
action? : string;
dest? : string;
help? : string;
metavar? : string;
}
interface SubArgumentParserOptions extends ArgumentParserOptions {
aliases? : string[];
help? : string;
}
interface ArgumentParserOptions {
description? : string;
epilog? : string;
addHelp? : boolean;
argumentDefault? : any;
parents? : ArgumentParser[];
prefixChars? : string;
formatterClass? : {new() : HelpFormatter|ArgumentDefaultsHelpFormatter|RawDescriptionHelpFormatter|RawTextHelpFormatter};
prog? : string;
usage? : string;
version? : string;
}
interface ArgumentGroupOptions {
prefixChars? : string;
argumentDefault? : any;
title? : string;
description? : string;
}
export class HelpFormatter {}
export class ArgumentDefaultsHelpFormatter {}
export class RawDescriptionHelpFormatter {}
export class RawTextHelpFormatter {}
interface ArgumentOptions {
action? : string;
optionStrings? : string[];
dest? : string;
nargs? : string|number;
constant? : any;
defaultValue? : any;
type? : string|Function;
choices? : string|string[];
required? : boolean;
help? : string;
metavar? : string;
}
}