|
| 1 | +// Type definitions for argparse v1.0.3 |
| 2 | +// Project: https://github.com/nodeca/argparse |
| 3 | +// Definitions by: Andrew Schurman <http://github.com/arcticwaters> |
| 4 | +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped |
| 5 | + |
| 6 | +declare module "argparse" { |
| 7 | + export class ArgumentParser extends ArgumentGroup { |
| 8 | + constructor(options? : ArgumentParserOptions); |
| 9 | + |
| 10 | + addSubparsers(options? : SubparserOptions) : SubParser; |
| 11 | + parseArgs(args? : string[], ns? : Namespace|Object) : any; |
| 12 | + printUsage() : void; |
| 13 | + printHelp() : void; |
| 14 | + formatUsage() : string; |
| 15 | + formatHelp() : string; |
| 16 | + parseKnownArgs(args? : string[], ns? : Namespace|Object) : any[]; |
| 17 | + convertArgLineToArg(argLine : string) : string[]; |
| 18 | + exit(status : number, message : string) : void; |
| 19 | + error(err : string|Error) : void; |
| 20 | + } |
| 21 | + |
| 22 | + interface Namespace {} |
| 23 | + |
| 24 | + class SubParser { |
| 25 | + addParser(name : string, options? : SubArgumentParserOptions) : ArgumentParser; |
| 26 | + } |
| 27 | + |
| 28 | + class ArgumentGroup { |
| 29 | + addArgument(args : string[], options? : ArgumentOptions) : void; |
| 30 | + addArgumentGroup(options? : ArgumentGroupOptions) : ArgumentGroup; |
| 31 | + addMutuallyExclusiveGroup(options? : {required : boolean}) : ArgumentGroup; |
| 32 | + setDefaults(options? : {}) : void; |
| 33 | + getDefault(dest : string) : any; |
| 34 | + } |
| 35 | + |
| 36 | + interface SubparserOptions { |
| 37 | + title? : string; |
| 38 | + description? : string; |
| 39 | + prog? : string; |
| 40 | + parserClass? : {new() : any}; |
| 41 | + action? : string; |
| 42 | + dest? : string; |
| 43 | + help? : string; |
| 44 | + metavar? : string; |
| 45 | + } |
| 46 | + |
| 47 | + interface SubArgumentParserOptions extends ArgumentParserOptions { |
| 48 | + aliases? : string[]; |
| 49 | + help? : string; |
| 50 | + } |
| 51 | + |
| 52 | + interface ArgumentParserOptions { |
| 53 | + description? : string; |
| 54 | + epilog? : string; |
| 55 | + addHelp? : boolean; |
| 56 | + argumentDefault? : any; |
| 57 | + parents? : ArgumentParser[]; |
| 58 | + prefixChars? : string; |
| 59 | + formatterClass? : {new() : HelpFormatter|ArgumentDefaultsHelpFormatter|RawDescriptionHelpFormatter|RawTextHelpFormatter}; |
| 60 | + prog? : string; |
| 61 | + usage? : string; |
| 62 | + version? : string; |
| 63 | + } |
| 64 | + |
| 65 | + interface ArgumentGroupOptions { |
| 66 | + prefixChars? : string; |
| 67 | + argumentDefault? : any; |
| 68 | + title? : string; |
| 69 | + description? : string; |
| 70 | + } |
| 71 | + |
| 72 | + export class HelpFormatter {} |
| 73 | + export class ArgumentDefaultsHelpFormatter {} |
| 74 | + export class RawDescriptionHelpFormatter {} |
| 75 | + export class RawTextHelpFormatter {} |
| 76 | + |
| 77 | + interface ArgumentOptions { |
| 78 | + action? : string; |
| 79 | + optionStrings? : string[]; |
| 80 | + dest? : string; |
| 81 | + nargs? : string|number; |
| 82 | + constant? : any; |
| 83 | + defaultValue? : any; |
| 84 | + type? : string|Function; |
| 85 | + choices? : string|string[]; |
| 86 | + required? : boolean; |
| 87 | + help? : string; |
| 88 | + metavar? : string; |
| 89 | + } |
| 90 | +} |
0 commit comments