bob-core 3.0.0-beta.11 → 3.0.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/HelpFlag.d.ts +4 -4
- package/dist/cjs/args/index.d.ts +31 -31
- package/dist/cjs/flags/boolean.d.ts +5 -5
- package/dist/cjs/flags/custom.d.ts +2 -2
- package/dist/cjs/flags/directory.d.ts +7 -7
- package/dist/cjs/flags/file.d.ts +7 -7
- package/dist/cjs/flags/index.d.ts +36 -36
- package/dist/cjs/flags/number.d.ts +7 -7
- package/dist/cjs/flags/option.d.ts +26 -3
- package/dist/cjs/flags/string.d.ts +5 -5
- package/dist/cjs/flags/url.d.ts +5 -5
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/lib/types.d.ts +9 -9
- package/dist/cjs/shared/ask-helpers.d.ts +1 -1
- package/dist/cjs/shared/flagsUtils.d.ts +0 -2
- package/dist/esm/HelpFlag.d.ts +4 -4
- package/dist/esm/args/index.d.ts +31 -31
- package/dist/esm/flags/boolean.d.ts +5 -5
- package/dist/esm/flags/custom.d.ts +2 -2
- package/dist/esm/flags/directory.d.ts +7 -7
- package/dist/esm/flags/file.d.ts +7 -7
- package/dist/esm/flags/index.d.ts +36 -36
- package/dist/esm/flags/number.d.ts +7 -7
- package/dist/esm/flags/option.d.ts +26 -3
- package/dist/esm/flags/string.d.ts +5 -5
- package/dist/esm/flags/url.d.ts +5 -5
- package/dist/esm/index.js +3 -5
- package/dist/esm/lib/types.d.ts +9 -9
- package/dist/esm/shared/ask-helpers.d.ts +1 -1
- package/dist/esm/shared/flagsUtils.d.ts +0 -2
- package/package.json +1 -1
|
@@ -17,41 +17,41 @@ import { optionFlag } from './option.js';
|
|
|
17
17
|
* default, multiple, ask, handler, help) plus its builder-specific extras.
|
|
18
18
|
*/
|
|
19
19
|
export declare const Flags: {
|
|
20
|
-
string: <
|
|
20
|
+
string: <const O extends Partial<import('../index.js').FlagDefinition<string, import('../index.js').CustomOptions>> = Partial<import('../index.js').FlagDefinition<string, import('../index.js').CustomOptions>>>(overrides?: O | undefined) => {
|
|
21
21
|
[x: string]: unknown;
|
|
22
22
|
} & {
|
|
23
|
-
parse: (input: any, opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions
|
|
23
|
+
parse: (input: any, opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions>) => string;
|
|
24
24
|
type?: import('../index.js').FlagKind;
|
|
25
|
-
ask?: ((opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions
|
|
25
|
+
ask?: ((opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions>) => Promise<any>) | undefined;
|
|
26
26
|
description?: string;
|
|
27
27
|
required?: boolean;
|
|
28
28
|
default?: string | string[] | (() => string | string[] | null) | (() => Promise<string | string[] | null>) | null | undefined;
|
|
29
29
|
multiple?: boolean;
|
|
30
30
|
help?: string;
|
|
31
31
|
alias?: string | readonly string[];
|
|
32
|
-
handler?: ((value: string, opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions
|
|
32
|
+
handler?: ((value: string, opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions>) => {
|
|
33
33
|
shouldStop: boolean;
|
|
34
34
|
} | void) | undefined;
|
|
35
|
-
} & Partial<import('../index.js').FlagDefinition<string, import('../index.js').CustomOptions
|
|
36
|
-
number: <
|
|
35
|
+
} & Partial<import('../index.js').FlagDefinition<string, import('../index.js').CustomOptions>> & O;
|
|
36
|
+
number: <const O extends Partial<import('../index.js').FlagDefinition<number, {
|
|
37
37
|
min?: number;
|
|
38
38
|
max?: number;
|
|
39
|
-
}
|
|
39
|
+
}>> = Partial<import('../index.js').FlagDefinition<number, {
|
|
40
40
|
min?: number;
|
|
41
41
|
max?: number;
|
|
42
|
-
}
|
|
42
|
+
}>>>(overrides?: O | undefined) => {
|
|
43
43
|
min?: number | undefined;
|
|
44
44
|
max?: number | undefined;
|
|
45
45
|
} & {
|
|
46
46
|
parse: (input: any, opts: import('../index.js').FlagOpts<number, {
|
|
47
47
|
min?: number;
|
|
48
48
|
max?: number;
|
|
49
|
-
}
|
|
49
|
+
}>) => number;
|
|
50
50
|
type?: import('../index.js').FlagKind;
|
|
51
51
|
ask?: ((opts: import('../index.js').FlagOpts<number, {
|
|
52
52
|
min?: number;
|
|
53
53
|
max?: number;
|
|
54
|
-
}
|
|
54
|
+
}>) => Promise<any>) | undefined;
|
|
55
55
|
description?: string;
|
|
56
56
|
required?: boolean;
|
|
57
57
|
default?: number | number[] | (() => number | number[] | null) | (() => Promise<number | number[] | null>) | null | undefined;
|
|
@@ -61,44 +61,44 @@ export declare const Flags: {
|
|
|
61
61
|
handler?: ((value: number, opts: import('../index.js').FlagOpts<number, {
|
|
62
62
|
min?: number;
|
|
63
63
|
max?: number;
|
|
64
|
-
}
|
|
64
|
+
}>) => {
|
|
65
65
|
shouldStop: boolean;
|
|
66
66
|
} | void) | undefined;
|
|
67
67
|
} & Partial<import('../index.js').FlagDefinition<number, {
|
|
68
68
|
min?: number;
|
|
69
69
|
max?: number;
|
|
70
|
-
}
|
|
71
|
-
boolean: <
|
|
70
|
+
}>> & O;
|
|
71
|
+
boolean: <const O extends Partial<import('../index.js').FlagDefinition<boolean, import('../index.js').CustomOptions>> = Partial<import('../index.js').FlagDefinition<boolean, import('../index.js').CustomOptions>>>(overrides?: O | undefined) => {
|
|
72
72
|
[x: string]: unknown;
|
|
73
73
|
} & {
|
|
74
|
-
parse: (input: any, opts: import('../index.js').FlagOpts<boolean, import('../index.js').CustomOptions
|
|
74
|
+
parse: (input: any, opts: import('../index.js').FlagOpts<boolean, import('../index.js').CustomOptions>) => boolean;
|
|
75
75
|
type?: import('../index.js').FlagKind;
|
|
76
|
-
ask?: ((opts: import('../index.js').FlagOpts<boolean, import('../index.js').CustomOptions
|
|
76
|
+
ask?: ((opts: import('../index.js').FlagOpts<boolean, import('../index.js').CustomOptions>) => Promise<any>) | undefined;
|
|
77
77
|
description?: string;
|
|
78
78
|
required?: boolean;
|
|
79
79
|
default?: boolean | boolean[] | (() => boolean | boolean[] | null) | (() => Promise<boolean | boolean[] | null>) | null | undefined;
|
|
80
80
|
multiple?: boolean;
|
|
81
81
|
help?: string;
|
|
82
82
|
alias?: string | readonly string[];
|
|
83
|
-
handler?: ((value: boolean, opts: import('../index.js').FlagOpts<boolean, import('../index.js').CustomOptions
|
|
83
|
+
handler?: ((value: boolean, opts: import('../index.js').FlagOpts<boolean, import('../index.js').CustomOptions>) => {
|
|
84
84
|
shouldStop: boolean;
|
|
85
85
|
} | void) | undefined;
|
|
86
|
-
} & Partial<import('../index.js').FlagDefinition<boolean, import('../index.js').CustomOptions
|
|
86
|
+
} & Partial<import('../index.js').FlagDefinition<boolean, import('../index.js').CustomOptions>> & O;
|
|
87
87
|
option: typeof optionFlag;
|
|
88
|
-
file: <
|
|
88
|
+
file: <const O extends Partial<import('../index.js').FlagDefinition<string, {
|
|
89
89
|
exists?: boolean;
|
|
90
|
-
}
|
|
90
|
+
}>> = Partial<import('../index.js').FlagDefinition<string, {
|
|
91
91
|
exists?: boolean;
|
|
92
|
-
}
|
|
92
|
+
}>>>(overrides?: O | undefined) => {
|
|
93
93
|
exists?: boolean | undefined;
|
|
94
94
|
} & {
|
|
95
95
|
parse: (input: any, opts: import('../index.js').FlagOpts<string, {
|
|
96
96
|
exists?: boolean;
|
|
97
|
-
}
|
|
97
|
+
}>) => string;
|
|
98
98
|
type?: import('../index.js').FlagKind;
|
|
99
99
|
ask?: ((opts: import('../index.js').FlagOpts<string, {
|
|
100
100
|
exists?: boolean;
|
|
101
|
-
}
|
|
101
|
+
}>) => Promise<any>) | undefined;
|
|
102
102
|
description?: string;
|
|
103
103
|
required?: boolean;
|
|
104
104
|
default?: string | string[] | (() => string | string[] | null) | (() => Promise<string | string[] | null>) | null | undefined;
|
|
@@ -107,26 +107,26 @@ export declare const Flags: {
|
|
|
107
107
|
alias?: string | readonly string[];
|
|
108
108
|
handler?: ((value: string, opts: import('../index.js').FlagOpts<string, {
|
|
109
109
|
exists?: boolean;
|
|
110
|
-
}
|
|
110
|
+
}>) => {
|
|
111
111
|
shouldStop: boolean;
|
|
112
112
|
} | void) | undefined;
|
|
113
113
|
} & Partial<import('../index.js').FlagDefinition<string, {
|
|
114
114
|
exists?: boolean;
|
|
115
|
-
}
|
|
116
|
-
directory: <
|
|
115
|
+
}>> & O;
|
|
116
|
+
directory: <const O extends Partial<import('../index.js').FlagDefinition<string, {
|
|
117
117
|
exists?: boolean;
|
|
118
|
-
}
|
|
118
|
+
}>> = Partial<import('../index.js').FlagDefinition<string, {
|
|
119
119
|
exists?: boolean;
|
|
120
|
-
}
|
|
120
|
+
}>>>(overrides?: O | undefined) => {
|
|
121
121
|
exists?: boolean | undefined;
|
|
122
122
|
} & {
|
|
123
123
|
parse: (input: any, opts: import('../index.js').FlagOpts<string, {
|
|
124
124
|
exists?: boolean;
|
|
125
|
-
}
|
|
125
|
+
}>) => string;
|
|
126
126
|
type?: import('../index.js').FlagKind;
|
|
127
127
|
ask?: ((opts: import('../index.js').FlagOpts<string, {
|
|
128
128
|
exists?: boolean;
|
|
129
|
-
}
|
|
129
|
+
}>) => Promise<any>) | undefined;
|
|
130
130
|
description?: string;
|
|
131
131
|
required?: boolean;
|
|
132
132
|
default?: string | string[] | (() => string | string[] | null) | (() => Promise<string | string[] | null>) | null | undefined;
|
|
@@ -135,28 +135,28 @@ export declare const Flags: {
|
|
|
135
135
|
alias?: string | readonly string[];
|
|
136
136
|
handler?: ((value: string, opts: import('../index.js').FlagOpts<string, {
|
|
137
137
|
exists?: boolean;
|
|
138
|
-
}
|
|
138
|
+
}>) => {
|
|
139
139
|
shouldStop: boolean;
|
|
140
140
|
} | void) | undefined;
|
|
141
141
|
} & Partial<import('../index.js').FlagDefinition<string, {
|
|
142
142
|
exists?: boolean;
|
|
143
|
-
}
|
|
144
|
-
url: <
|
|
143
|
+
}>> & O;
|
|
144
|
+
url: <const O extends Partial<import('../index.js').FlagDefinition<URL, import('../index.js').CustomOptions>> = Partial<import('../index.js').FlagDefinition<URL, import('../index.js').CustomOptions>>>(overrides?: O | undefined) => {
|
|
145
145
|
[x: string]: unknown;
|
|
146
146
|
} & {
|
|
147
|
-
parse: (input: any, opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions
|
|
147
|
+
parse: (input: any, opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions>) => URL;
|
|
148
148
|
type?: import('../index.js').FlagKind;
|
|
149
|
-
ask?: ((opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions
|
|
149
|
+
ask?: ((opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions>) => Promise<any>) | undefined;
|
|
150
150
|
description?: string;
|
|
151
151
|
required?: boolean;
|
|
152
152
|
default?: URL | URL[] | (() => URL | URL[] | null) | (() => Promise<URL | URL[] | null>) | null | undefined;
|
|
153
153
|
multiple?: boolean;
|
|
154
154
|
help?: string;
|
|
155
155
|
alias?: string | readonly string[];
|
|
156
|
-
handler?: ((value: URL, opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions
|
|
156
|
+
handler?: ((value: URL, opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions>) => {
|
|
157
157
|
shouldStop: boolean;
|
|
158
158
|
} | void) | undefined;
|
|
159
|
-
} & Partial<import('../index.js').FlagDefinition<URL, import('../index.js').CustomOptions
|
|
159
|
+
} & Partial<import('../index.js').FlagDefinition<URL, import('../index.js').CustomOptions>> & O;
|
|
160
160
|
custom: typeof custom;
|
|
161
161
|
};
|
|
162
162
|
export { Args } from '../args/index.js';
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/** Numeric flag. Optional `min`/`max` clamp the accepted range and surface as `BadCommandFlag`. */
|
|
2
|
-
export declare const numberFlag: <
|
|
2
|
+
export declare const numberFlag: <const O extends Partial<import('../index.js').FlagDefinition<number, {
|
|
3
3
|
min?: number;
|
|
4
4
|
max?: number;
|
|
5
|
-
}
|
|
5
|
+
}>> = Partial<import('../index.js').FlagDefinition<number, {
|
|
6
6
|
min?: number;
|
|
7
7
|
max?: number;
|
|
8
|
-
}
|
|
8
|
+
}>>>(overrides?: O | undefined) => {
|
|
9
9
|
min?: number | undefined;
|
|
10
10
|
max?: number | undefined;
|
|
11
11
|
} & {
|
|
12
12
|
parse: (input: any, opts: import('../index.js').FlagOpts<number, {
|
|
13
13
|
min?: number;
|
|
14
14
|
max?: number;
|
|
15
|
-
}
|
|
15
|
+
}>) => number;
|
|
16
16
|
type?: import('../index.js').FlagKind;
|
|
17
17
|
ask?: ((opts: import('../index.js').FlagOpts<number, {
|
|
18
18
|
min?: number;
|
|
19
19
|
max?: number;
|
|
20
|
-
}
|
|
20
|
+
}>) => Promise<any>) | undefined;
|
|
21
21
|
description?: string;
|
|
22
22
|
required?: boolean;
|
|
23
23
|
default?: number | number[] | (() => number | number[] | null) | (() => Promise<number | number[] | null>) | null | undefined;
|
|
@@ -27,10 +27,10 @@ export declare const numberFlag: <Ctx extends unknown = any, const O extends Par
|
|
|
27
27
|
handler?: ((value: number, opts: import('../index.js').FlagOpts<number, {
|
|
28
28
|
min?: number;
|
|
29
29
|
max?: number;
|
|
30
|
-
}
|
|
30
|
+
}>) => {
|
|
31
31
|
shouldStop: boolean;
|
|
32
32
|
} | void) | undefined;
|
|
33
33
|
} & Partial<import('../index.js').FlagDefinition<number, {
|
|
34
34
|
min?: number;
|
|
35
35
|
max?: number;
|
|
36
|
-
}
|
|
36
|
+
}>> & O;
|
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InitFlagDefinition } from '../lib/types.js';
|
|
2
2
|
export declare function optionFlag<const T extends readonly string[], const O extends Partial<InitFlagDefinition<T[number], {
|
|
3
3
|
options: T;
|
|
4
4
|
}>>>(opts: {
|
|
5
5
|
options: T;
|
|
6
|
-
} & O):
|
|
6
|
+
} & O): {
|
|
7
7
|
options: T;
|
|
8
|
-
}
|
|
8
|
+
} & {
|
|
9
|
+
parse: (input: any, opts: import('../lib/types.js').FlagOpts<T[number], {
|
|
10
|
+
options: T;
|
|
11
|
+
}>) => T[number];
|
|
12
|
+
type?: import('../lib/types.js').FlagKind;
|
|
13
|
+
ask?: ((opts: import('../lib/types.js').FlagOpts<T[number], {
|
|
14
|
+
options: T;
|
|
15
|
+
}>) => Promise<any>) | undefined;
|
|
16
|
+
description?: string;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
default?: T[number] | T[number][] | (() => T[number] | T[number][] | null) | (() => Promise<T[number] | T[number][] | null>) | null | undefined;
|
|
19
|
+
multiple?: boolean;
|
|
20
|
+
help?: string;
|
|
21
|
+
alias?: string | readonly string[];
|
|
22
|
+
handler?: ((value: T[number], opts: import('../lib/types.js').FlagOpts<T[number], {
|
|
23
|
+
options: T;
|
|
24
|
+
}>) => {
|
|
25
|
+
shouldStop: boolean;
|
|
26
|
+
} | void) | undefined;
|
|
27
|
+
} & Partial<import('../lib/types.js').FlagDefinition<T[number], {
|
|
28
|
+
options: T;
|
|
29
|
+
}>> & {
|
|
30
|
+
options: T;
|
|
31
|
+
} & O;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/** Text input flag. Pass `secret: true` to mask the prompt as a password. */
|
|
2
|
-
export declare const stringFlag: <
|
|
2
|
+
export declare const stringFlag: <const O extends Partial<import('../index.js').FlagDefinition<string, import('../index.js').CustomOptions>> = Partial<import('../index.js').FlagDefinition<string, import('../index.js').CustomOptions>>>(overrides?: O | undefined) => {
|
|
3
3
|
[x: string]: unknown;
|
|
4
4
|
} & {
|
|
5
|
-
parse: (input: any, opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions
|
|
5
|
+
parse: (input: any, opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions>) => string;
|
|
6
6
|
type?: import('../index.js').FlagKind;
|
|
7
|
-
ask?: ((opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions
|
|
7
|
+
ask?: ((opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions>) => Promise<any>) | undefined;
|
|
8
8
|
description?: string;
|
|
9
9
|
required?: boolean;
|
|
10
10
|
default?: string | string[] | (() => string | string[] | null) | (() => Promise<string | string[] | null>) | null | undefined;
|
|
11
11
|
multiple?: boolean;
|
|
12
12
|
help?: string;
|
|
13
13
|
alias?: string | readonly string[];
|
|
14
|
-
handler?: ((value: string, opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions
|
|
14
|
+
handler?: ((value: string, opts: import('../index.js').FlagOpts<string, import('../index.js').CustomOptions>) => {
|
|
15
15
|
shouldStop: boolean;
|
|
16
16
|
} | void) | undefined;
|
|
17
|
-
} & Partial<import('../index.js').FlagDefinition<string, import('../index.js').CustomOptions
|
|
17
|
+
} & Partial<import('../index.js').FlagDefinition<string, import('../index.js').CustomOptions>> & O;
|
package/dist/esm/flags/url.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/** URL flag — parses the input with `new URL()` and returns the resulting `URL` object. */
|
|
2
|
-
export declare const urlFlag: <
|
|
2
|
+
export declare const urlFlag: <const O extends Partial<import('../index.js').FlagDefinition<URL, import('../index.js').CustomOptions>> = Partial<import('../index.js').FlagDefinition<URL, import('../index.js').CustomOptions>>>(overrides?: O | undefined) => {
|
|
3
3
|
[x: string]: unknown;
|
|
4
4
|
} & {
|
|
5
|
-
parse: (input: any, opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions
|
|
5
|
+
parse: (input: any, opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions>) => URL;
|
|
6
6
|
type?: import('../index.js').FlagKind;
|
|
7
|
-
ask?: ((opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions
|
|
7
|
+
ask?: ((opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions>) => Promise<any>) | undefined;
|
|
8
8
|
description?: string;
|
|
9
9
|
required?: boolean;
|
|
10
10
|
default?: URL | URL[] | (() => URL | URL[] | null) | (() => Promise<URL | URL[] | null>) | null | undefined;
|
|
11
11
|
multiple?: boolean;
|
|
12
12
|
help?: string;
|
|
13
13
|
alias?: string | readonly string[];
|
|
14
|
-
handler?: ((value: URL, opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions
|
|
14
|
+
handler?: ((value: URL, opts: import('../index.js').FlagOpts<URL, import('../index.js').CustomOptions>) => {
|
|
15
15
|
shouldStop: boolean;
|
|
16
16
|
} | void) | undefined;
|
|
17
|
-
} & Partial<import('../index.js').FlagDefinition<URL, import('../index.js').CustomOptions
|
|
17
|
+
} & Partial<import('../index.js').FlagDefinition<URL, import('../index.js').CustomOptions>> & O;
|
package/dist/esm/index.js
CHANGED
|
@@ -536,13 +536,11 @@ var F = M({
|
|
|
536
536
|
//#endregion
|
|
537
537
|
//#region src/flags/option.ts
|
|
538
538
|
function R(e) {
|
|
539
|
-
let { options: t, ...n } = e;
|
|
540
539
|
return M({
|
|
541
540
|
type: "option",
|
|
542
541
|
ask: Ee,
|
|
543
|
-
parse: (
|
|
544
|
-
|
|
545
|
-
})(n);
|
|
542
|
+
parse: (t) => ye(t, e.options ?? [])
|
|
543
|
+
})(e);
|
|
546
544
|
}
|
|
547
545
|
//#endregion
|
|
548
546
|
//#region src/flags/string.ts
|
|
@@ -1160,7 +1158,7 @@ var Ke = .75, qe = .55, Je = .05, Ye = class {
|
|
|
1160
1158
|
}, Ze = /* @__PURE__ */ ue(Ne(), 1);
|
|
1161
1159
|
function Qe() {
|
|
1162
1160
|
try {
|
|
1163
|
-
let e = n((0, Ze.fileURLToPath)(new URL("data:application/json;base64,
|
|
1161
|
+
let e = n((0, Ze.fileURLToPath)(new URL("data:application/json;base64,ewogICJuYW1lIjogImJvYi1jb3JlIiwKICAidmVyc2lvbiI6ICIzLjAuMC1iZXRhLjEzIiwKICAiZGVzY3JpcHRpb24iOiAiQk9CIENvcmUiLAogICJ0eXBlIjogIm1vZHVsZSIsCiAgIm1haW4iOiAiLi9kaXN0L2Nqcy9pbmRleC5qcyIsCiAgIm1vZHVsZSI6ICIuL2Rpc3QvZXNtL2luZGV4LmpzIiwKICAidHlwZXMiOiAiLi9kaXN0L2VzbS9pbmRleC5kLnRzIiwKICAiZmlsZXMiOiBbCiAgICAiZGlzdCIKICBdLAogICJleHBvcnRzIjogewogICAgIi4iOiB7CiAgICAgICJpbXBvcnQiOiB7CiAgICAgICAgInR5cGVzIjogIi4vZGlzdC9lc20vaW5kZXguZC50cyIsCiAgICAgICAgImRlZmF1bHQiOiAiLi9kaXN0L2VzbS9pbmRleC5qcyIKICAgICAgfSwKICAgICAgInJlcXVpcmUiOiB7CiAgICAgICAgInR5cGVzIjogIi4vZGlzdC9janMvaW5kZXguZC50cyIsCiAgICAgICAgImRlZmF1bHQiOiAiLi9kaXN0L2Nqcy9pbmRleC5qcyIKICAgICAgfQogICAgfQogIH0sCiAgInNjcmlwdHMiOiB7CiAgICAic3RhcnQiOiAibm9kZSAtciBAc3djLW5vZGUvcmVnaXN0ZXIgZGVidWcvbWFpbi50cyIsCiAgICAiYnVpbGQiOiAicm0gLXJmIC4vZGlzdCAmJiB2aXRlIGJ1aWxkIiwKICAgICJ0eXBlY2hlY2siOiAidHNjIC0tbm9FbWl0IiwKICAgICJwcmVwYWNrIjogIm5wbSBydW4gYnVpbGQiLAogICAgInRlc3QiOiAidml0ZXN0IHJ1biIsCiAgICAibGludCI6ICJlc2xpbnQgLiIsCiAgICAibGludDpmaXgiOiAiZXNsaW50IC4gLS1maXgiCiAgfSwKICAiYXV0aG9yIjogIkzDqW8gSHViZXJ0IiwKICAibGljZW5zZSI6ICJJU0MiLAogICJkZXZEZXBlbmRlbmNpZXMiOiB7CiAgICAiQGVzbGludC9qcyI6ICJeOS4zOS40IiwKICAgICJAZmFrZXItanMvZmFrZXIiOiAiXjEwLjMuMCIsCiAgICAiQHN3Yy1ub2RlL3JlZ2lzdGVyIjogIl4xLjExLjEiLAogICAgIkB0cml2YWdvL3ByZXR0aWVyLXBsdWdpbi1zb3J0LWltcG9ydHMiOiAiXjUuMi4yIiwKICAgICJAdHlwZXMvbWluaW1pc3QiOiAiXjEuMi41IiwKICAgICJAdHlwZXMvbm9kZSI6ICJeMjAuMTQuNSIsCiAgICAiQHR5cGVzL3N0cmluZy1zaW1pbGFyaXR5IjogIl40LjAuMiIsCiAgICAiQHZpdGVzdC9jb3ZlcmFnZS12OCI6ICJeNC4xLjAiLAogICAgImVzbGludCI6ICJeOS4zOS40IiwKICAgICJlc2xpbnQtY29uZmlnLXByZXR0aWVyIjogIl4xMC4xLjgiLAogICAgImVzbGludC1wbHVnaW4tcHJldHRpZXIiOiAiXjUuNS41IiwKICAgICJwcmV0dGllciI6ICJeMy42LjIiLAogICAgInRzeCI6ICJeNC4yMS4wIiwKICAgICJ0eXBlc2NyaXB0IjogIl41LjkuMyIsCiAgICAidHlwZXNjcmlwdC1lc2xpbnQiOiAiXjguNTcuMCIsCiAgICAidml0ZSI6ICJeOC4wLjAiLAogICAgInZpdGUtcGx1Z2luLWR0cyI6ICJeNC41LjQiLAogICAgInZpdGVzdCI6ICJeNC4xLjAiCiAgfSwKICAiZGVwZW5kZW5jaWVzIjogewogICAgIkBpbnF1aXJlci9jb3JlIjogIl4xMS4xLjgiLAogICAgIkBpbnF1aXJlci9wcm9tcHRzIjogIl44LjQuMSIsCiAgICAiY2hhbGsiOiAiXjUuNi4yIiwKICAgICJpbnF1aXJlci1maWxlLXNlbGVjdG9yIjogIl4xLjAuMSIsCiAgICAibWluaW1pc3QiOiAiXjEuMi44IgogIH0KfQo=", "" + import.meta.url)), "utf8");
|
|
1164
1162
|
return JSON.parse(e).version ?? "0.0.0";
|
|
1165
1163
|
} catch {
|
|
1166
1164
|
return "0.0.0";
|
package/dist/esm/lib/types.d.ts
CHANGED
|
@@ -11,30 +11,30 @@ export type FlagKind = 'string' | 'number' | 'boolean' | 'option' | 'file' | 'di
|
|
|
11
11
|
* {@link FlagDefinition}, so handlers can read them without `any` casts while still
|
|
12
12
|
* being honest that they are optional at the type level.
|
|
13
13
|
*/
|
|
14
|
-
export type FlagOpts<T = any, C extends CustomOptions = CustomOptions
|
|
14
|
+
export type FlagOpts<T = any, C extends CustomOptions = CustomOptions> = {
|
|
15
15
|
name: string;
|
|
16
16
|
ux: UX;
|
|
17
|
-
ctx:
|
|
18
|
-
definition: FlagDefinition<T, C
|
|
19
|
-
cmd: typeof Command
|
|
17
|
+
ctx: ContextDefinition;
|
|
18
|
+
definition: FlagDefinition<T, C>;
|
|
19
|
+
cmd: typeof Command;
|
|
20
20
|
};
|
|
21
|
-
export type FlagDefinition<T = any, C extends CustomOptions = CustomOptions
|
|
21
|
+
export type FlagDefinition<T = any, C extends CustomOptions = CustomOptions> = {
|
|
22
22
|
[key in keyof C]: C[keyof C];
|
|
23
23
|
} & {
|
|
24
|
-
parse: (input: any, opts: FlagOpts<T, C
|
|
24
|
+
parse: (input: any, opts: FlagOpts<T, C>) => T;
|
|
25
25
|
type?: FlagKind;
|
|
26
|
-
ask?: (opts: FlagOpts<T, C
|
|
26
|
+
ask?: (opts: FlagOpts<T, C>) => Promise<any>;
|
|
27
27
|
description?: string;
|
|
28
28
|
required?: boolean;
|
|
29
29
|
default?: T | T[] | null | (() => T | T[] | null) | (() => Promise<T | T[] | null>);
|
|
30
30
|
multiple?: boolean;
|
|
31
31
|
help?: string;
|
|
32
32
|
alias?: string | readonly string[];
|
|
33
|
-
handler?: (value: T, opts: FlagOpts<T, C
|
|
33
|
+
handler?: (value: T, opts: FlagOpts<T, C>) => {
|
|
34
34
|
shouldStop: boolean;
|
|
35
35
|
} | void;
|
|
36
36
|
};
|
|
37
|
-
export type InitFlagDefinition<T = any, C extends CustomOptions = CustomOptions
|
|
37
|
+
export type InitFlagDefinition<T = any, C extends CustomOptions = CustomOptions> = Partial<FlagDefinition<T, C>>;
|
|
38
38
|
/** Infers the runtime return type of a flag definition, accounting for `multiple`. */
|
|
39
39
|
export type InferFlagReturn<O> = O extends {
|
|
40
40
|
parse: (...args: any[]) => infer R;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FlagOpts } from '../lib/types.js';
|
|
2
2
|
export declare function buildStringAsk(builderOpts: FlagOpts): Promise<any>;
|
|
3
3
|
export declare function buildNumberAsk(builderOpts: FlagOpts): Promise<any>;
|
|
4
|
-
export declare function buildOptionAsk(builderOpts: FlagOpts): Promise<any>;
|
|
4
|
+
export declare function buildOptionAsk(builderOpts: FlagOpts<any, any>): Promise<any>;
|
|
5
5
|
export declare function buildFileAsk(builderOpts: FlagOpts): Promise<any>;
|
|
6
6
|
export declare function buildDirectoryAsk(builderOpts: FlagOpts): Promise<any>;
|
|
7
7
|
export declare function buildUrlAsk(builderOpts: FlagOpts): Promise<any>;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { numberFlag } from '../flags/number.js';
|
|
2
1
|
import { optionFlag } from '../flags/option.js';
|
|
3
2
|
import { FlagDefinition } from '../lib/types.js';
|
|
4
|
-
export declare function isNumberFlag(flag: FlagDefinition): flag is ReturnType<typeof numberFlag>;
|
|
5
3
|
export declare function isOptionFlag(flag: FlagDefinition<any, any>): flag is ReturnType<typeof optionFlag>;
|