-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
27 lines (26 loc) · 1.03 KB
/
index.d.ts
File metadata and controls
27 lines (26 loc) · 1.03 KB
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
/**
* Parses CLI flags and arguments into a structured object.
*
* @param options
* @param options.raw The raw arguments to parse. (default is process.argv.slice(2)).
* @param options.args Named positional arguments. Supports variadic last argument (e.g. '...files').
* @param options.alias Map of short keys to long keys, e.g. { f: 'files' }.
* @param options.array Keys that should collect multiple values into arrays.
* @param options.boolean Keys that should always be parsed as boolean flags.
* @param options.default Default values for missing flags.
* @returns Parsed CLI parameters including flags, positional arguments, and rest arguments.
*/
declare function flaget(options?: {
raw?: string[];
args?: string[];
alias?: Record<string, string>;
array?: string[];
boolean?: string[];
default?: Record<string, unknown>;
}): {
args: Record<string, string | string[] | undefined>;
flags: Record<string, string | number | boolean | (string | number | boolean)[]>;
_: string[];
_tail: string[];
};
export default flaget;