-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
64 lines (53 loc) · 1.74 KB
/
index.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
declare class FlagParser {
/**
* Map to store flags and their descriptions and default values
*/
#flags: Map<string, { description: string, defaultValue: any }>;
/**
* Stores the usage string
*/
#usage: string;
/**
* Parsed flags are stored here after calling the `parse` method
*/
public flags: { [key: string]: any };
/**
* Set the usage information for the flag parser.
* @param str The usage information to be displayed
* @returns The FlagParser instance for chaining
*/
usage(str: string): this;
/**
* Register a new flag with a description and an optional default value.
* @param flag The flag name (e.g. `verbose` for `--verbose`)
* @param description A description of what the flag does
* @param defaultValue (Optional) The default value for the flag if not provided
* @returns The FlagParser instance for chaining
* @throws Will throw an error if the flag or description is missing
*/
registerFlag(flag: string, description: string, defaultValue?: any): this;
/**
* Unregisters all flags from the parser.
*/
unregisterFlags(): void;
/**
* Parse the flags from `process.argv`.
* @returns An object where keys are the flag names and values are their respective values
*/
parse(): { [key: string]: any };
/**
* Print the help text to the console.
*/
help(): void;
/**
* Print help text to the console and exit with error.
*/
showHelp(): void;
/**
* Generate the output text for the help message.
* @returns The formatted help message string
*/
#outputText(): string;
}
declare const flagParserInstance: FlagParser;
export = flagParserInstance;