| 1 |
export type Nargs = number | '?' | '*' | '+' | 'A...' | '...' | '==SUPPRESS==' |
| 2 |
|
| 3 |
export type ArgumentType = |
| 4 |
| string |
| 5 |
| ((value: string) => unknown) |
| 6 |
| (new (value: string) => unknown) |
| 7 |
|
| 8 |
export interface ArgumentOptions { |
| 9 |
action?: string | ActionClass |
| 10 |
option_strings?: string[] |
| 11 |
dest?: string |
| 12 |
nargs?: Nargs |
| 13 |
const?: unknown |
| 14 |
default?: unknown |
| 15 |
type?: ArgumentType |
| 16 |
choices?: string | readonly unknown[] | object |
| 17 |
required?: boolean |
| 18 |
help?: string |
| 19 |
metavar?: string | string[] |
| 20 |
version?: string |
| 21 |
deprecated?: boolean |
| 22 |
} |
| 23 |
|
| 24 |
export interface ActionConstructorOptions extends ArgumentOptions { |
| 25 |
option_strings: string[] |
| 26 |
dest: string |
| 27 |
} |
| 28 |
|
| 29 |
export interface Action { |
| 30 |
option_strings: string[] |
| 31 |
dest: string |
| 32 |
nargs?: Nargs |
| 33 |
const?: unknown |
| 34 |
default?: unknown |
| 35 |
type?: ArgumentType |
| 36 |
choices?: string | readonly unknown[] | object |
| 37 |
required: boolean |
| 38 |
help?: string |
| 39 |
metavar?: string | string[] |
| 40 |
deprecated: boolean |
| 41 |
|
| 42 |
(parser: ArgumentParser, namespace: Namespace, values: unknown, option_string?: string): void |
| 43 |
call(parser: ArgumentParser, namespace: Namespace, values: unknown, option_string?: string): void |
| 44 |
format_usage(): string |
| 45 |
} |
| 46 |
|
| 47 |
export interface ActionClass { |
| 48 |
new (options: ActionConstructorOptions): Action |
| 49 |
readonly prototype: Action |
| 50 |
} |
| 51 |
|
| 52 |
export interface ActionConstructor extends ActionClass { |
| 53 |
(options: ActionConstructorOptions): Action |
| 54 |
} |
| 55 |
|
| 56 |
export const Action: ActionConstructor |
| 57 |
|
| 58 |
export interface BooleanOptionalAction extends Action {} |
| 59 |
|
| 60 |
export interface BooleanOptionalActionConstructor { |
| 61 |
new (options: ActionConstructorOptions): BooleanOptionalAction |
| 62 |
(options: ActionConstructorOptions): BooleanOptionalAction |
| 63 |
readonly prototype: BooleanOptionalAction |
| 64 |
} |
| 65 |
|
| 66 |
export const BooleanOptionalAction: BooleanOptionalActionConstructor |
| 67 |
|
| 68 |
export interface ArgumentError extends Error { |
| 69 |
str(): string |
| 70 |
} |
| 71 |
|
| 72 |
export interface ArgumentErrorConstructor { |
| 73 |
new (argument: Action | undefined, message: string): ArgumentError |
| 74 |
(argument: Action | undefined, message: string): ArgumentError |
| 75 |
readonly prototype: ArgumentError |
| 76 |
} |
| 77 |
|
| 78 |
export const ArgumentError: ArgumentErrorConstructor |
| 79 |
|
| 80 |
export interface ArgumentTypeError extends Error {} |
| 81 |
|
| 82 |
export interface ArgumentTypeErrorConstructor { |
| 83 |
new (message: string): ArgumentTypeError |
| 84 |
(message: string): ArgumentTypeError |
| 85 |
readonly prototype: ArgumentTypeError |
| 86 |
} |
| 87 |
|
| 88 |
export const ArgumentTypeError: ArgumentTypeErrorConstructor |
| 89 |
|
| 90 |
export interface HelpFormatterOptions { |
| 91 |
prog: string |
| 92 |
indent_increment?: number |
| 93 |
max_help_position?: number |
| 94 |
width?: number |
| 95 |
color?: boolean |
| 96 |
} |
| 97 |
|
| 98 |
export interface HelpFormatter {} |
| 99 |
|
| 100 |
export interface HelpFormatterClass { |
| 101 |
new (options: HelpFormatterOptions): HelpFormatter |
| 102 |
readonly prototype: HelpFormatter |
| 103 |
} |
| 104 |
|
| 105 |
export interface HelpFormatterConstructor extends HelpFormatterClass { |
| 106 |
(options: HelpFormatterOptions): HelpFormatter |
| 107 |
} |
| 108 |
|
| 109 |
export type HelpFormatterFactory = |
| 110 |
| HelpFormatterClass |
| 111 |
| ((options: HelpFormatterOptions) => HelpFormatter) |
| 112 |
|
| 113 |
export const HelpFormatter: HelpFormatterConstructor |
| 114 |
|
| 115 |
export interface RawDescriptionHelpFormatter extends HelpFormatter {} |
| 116 |
export const RawDescriptionHelpFormatter: HelpFormatterConstructor |
| 117 |
|
| 118 |
export interface RawTextHelpFormatter extends RawDescriptionHelpFormatter {} |
| 119 |
export const RawTextHelpFormatter: HelpFormatterConstructor |
| 120 |
|
| 121 |
export interface ArgumentDefaultsHelpFormatter extends HelpFormatter {} |
| 122 |
export const ArgumentDefaultsHelpFormatter: HelpFormatterConstructor |
| 123 |
|
| 124 |
export interface MetavarTypeHelpFormatter extends HelpFormatter {} |
| 125 |
export const MetavarTypeHelpFormatter: HelpFormatterConstructor |
| 126 |
|
| 127 |
export interface FileTypeOptions { |
| 128 |
flags?: string |
| 129 |
encoding?: string |
| 130 |
mode?: number |
| 131 |
autoClose?: boolean |
| 132 |
emitClose?: boolean |
| 133 |
start?: number |
| 134 |
end?: number |
| 135 |
highWaterMark?: number |
| 136 |
fs?: object |
| 137 |
} |
| 138 |
|
| 139 |
export interface FileTypeResult { |
| 140 |
path?: string |
| 141 |
close?: () => void |
| 142 |
[key: string]: unknown |
| 143 |
} |
| 144 |
|
| 145 |
export interface FileType { |
| 146 |
(value: string): FileTypeResult |
| 147 |
call(value: string): FileTypeResult |
| 148 |
} |
| 149 |
|
| 150 |
export interface FileTypeConstructor { |
| 151 |
new (options?: FileTypeOptions): FileType |
| 152 |
new (flags?: string, encoding?: string, mode?: number): FileType |
| 153 |
(options?: FileTypeOptions): FileType |
| 154 |
(flags?: string, encoding?: string, mode?: number): FileType |
| 155 |
readonly prototype: FileType |
| 156 |
} |
| 157 |
|
| 158 |
export const FileType: FileTypeConstructor |
| 159 |
|
| 160 |
export interface Namespace { |
| 161 |
[key: string]: any |
| 162 |
} |
| 163 |
|
| 164 |
export interface NamespaceConstructor { |
| 165 |
new (options?: object): Namespace |
| 166 |
(options?: object): Namespace |
| 167 |
readonly prototype: Namespace |
| 168 |
} |
| 169 |
|
| 170 |
export const Namespace: NamespaceConstructor |
| 171 |
|
| 172 |
export interface ArgumentGroupOptions { |
| 173 |
title?: string |
| 174 |
description?: string |
| 175 |
prefix_chars?: string |
| 176 |
argument_default?: unknown |
| 177 |
conflict_handler?: string |
| 178 |
} |
| 179 |
|
| 180 |
export interface MutuallyExclusiveGroupOptions { |
| 181 |
required?: boolean |
| 182 |
} |
| 183 |
|
| 184 |
export interface ActionsContainer { |
| 185 |
register(registry_name: string, value: unknown, object: unknown): void |
| 186 |
|
| 187 |
set_defaults(options: object): void |
| 188 |
get_default(dest: string): unknown |
| 189 |
|
| 190 |
add_argument(name: string, ...names: string[]): Action |
| 191 |
add_argument(name: string, ...namesAndOptions: [...string[], ArgumentOptions]): Action |
| 192 |
} |
| 193 |
|
| 194 |
export interface MutuallyExclusiveGroup extends ActionsContainer {} |
| 195 |
|
| 196 |
export interface ArgumentGroup extends ActionsContainer { |
| 197 |
add_mutually_exclusive_group(options?: MutuallyExclusiveGroupOptions): MutuallyExclusiveGroup |
| 198 |
} |
| 199 |
|
| 200 |
export interface ArgumentParserOptions { |
| 201 |
prog?: string |
| 202 |
usage?: string |
| 203 |
description?: string |
| 204 |
epilog?: string |
| 205 |
parents?: ArgumentParser[] |
| 206 |
formatter_class?: HelpFormatterFactory |
| 207 |
prefix_chars?: string |
| 208 |
fromfile_prefix_chars?: string |
| 209 |
argument_default?: unknown |
| 210 |
conflict_handler?: string |
| 211 |
add_help?: boolean |
| 212 |
allow_abbrev?: boolean |
| 213 |
exit_on_error?: boolean |
| 214 |
suggest_on_error?: boolean |
| 215 |
color?: boolean |
| 216 |
} |
| 217 |
|
| 218 |
export interface SubparserOptions { |
| 219 |
title?: string |
| 220 |
description?: string |
| 221 |
prog?: string |
| 222 |
parser_class?: ArgumentParserClass |
| 223 |
action?: string | ActionClass |
| 224 |
dest?: string |
| 225 |
required?: boolean |
| 226 |
help?: string |
| 227 |
metavar?: string |
| 228 |
} |
| 229 |
|
| 230 |
export interface SubArgumentParserOptions extends ArgumentParserOptions { |
| 231 |
aliases?: string[] |
| 232 |
help?: string |
| 233 |
deprecated?: boolean |
| 234 |
} |
| 235 |
|
| 236 |
export interface SubparsersAction extends Action { |
| 237 |
add_parser(name: string, options?: SubArgumentParserOptions): ArgumentParser |
| 238 |
} |
| 239 |
|
| 240 |
export interface Writable { |
| 241 |
write(message: string): unknown |
| 242 |
} |
| 243 |
|
| 244 |
export interface ArgumentParser extends ArgumentGroup { |
| 245 |
prog: string |
| 246 |
usage?: string |
| 247 |
description?: string |
| 248 |
epilog?: string |
| 249 |
formatter_class: HelpFormatterFactory |
| 250 |
fromfile_prefix_chars?: string |
| 251 |
add_help: boolean |
| 252 |
allow_abbrev: boolean |
| 253 |
exit_on_error: boolean |
| 254 |
suggest_on_error: boolean |
| 255 |
color: boolean |
| 256 |
|
| 257 |
add_argument_group(options?: ArgumentGroupOptions): ArgumentGroup |
| 258 |
add_argument_group(title?: string, description?: string): ArgumentGroup |
| 259 |
add_mutually_exclusive_group(options?: MutuallyExclusiveGroupOptions): MutuallyExclusiveGroup |
| 260 |
add_subparsers(options?: SubparserOptions): SubparsersAction |
| 261 |
|
| 262 |
parse_args<T extends object = Namespace>(args?: string[], namespace?: T): T |
| 263 |
parse_known_args<T extends object = Namespace>(args?: string[], namespace?: T): [T, string[]] |
| 264 |
parse_intermixed_args<T extends object = Namespace>(args?: string[], namespace?: T): T |
| 265 |
parse_known_intermixed_args<T extends object = Namespace>(args?: string[], namespace?: T): [T, string[]] |
| 266 |
|
| 267 |
convert_arg_line_to_args(arg_line: string): string[] |
| 268 |
format_usage(): string |
| 269 |
format_help(): string |
| 270 |
print_usage(file?: Writable): void |
| 271 |
print_help(file?: Writable): void |
| 272 |
exit(status?: number, message?: string): void |
| 273 |
error(message: string): void |
| 274 |
} |
| 275 |
|
| 276 |
export interface ArgumentParserClass { |
| 277 |
new (options?: ArgumentParserOptions): ArgumentParser |
| 278 |
readonly prototype: ArgumentParser |
| 279 |
} |
| 280 |
|
| 281 |
export interface ArgumentParserConstructor extends ArgumentParserClass { |
| 282 |
(options?: ArgumentParserOptions): ArgumentParser |
| 283 |
} |
| 284 |
|
| 285 |
export const ArgumentParser: ArgumentParserConstructor |
| 286 |
|
| 287 |
export const SUPPRESS: '==SUPPRESS==' |
| 288 |
export const OPTIONAL: '?' |
| 289 |
export const ZERO_OR_MORE: '*' |
| 290 |
export const ONE_OR_MORE: '+' |
| 291 |
export const REMAINDER: '...' |
| 292 |
export const PARSER: 'A...' |