convoker 0.1.0 → 0.3.0
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/README.md +2 -2
- package/dist/chunks/{error-Cj2qDfOl.js → error-CyKscMUD.js} +5 -5
- package/dist/chunks/{index-G2nVXKup.js → index-BluQjWvw.js} +2 -2
- package/dist/chunks/{input-COjWPD53.js → input-WNu16aNE.js} +38 -35
- package/dist/chunks/{standard-schema-Dn3nwAxU.js → standard-schema-BHKzvwIS.js} +1 -1
- package/dist/command.d.ts +48 -20
- package/dist/command.js +220 -169
- package/dist/error.d.ts +78 -46
- package/dist/error.js +6 -6
- package/dist/index.d.ts +58 -30
- package/dist/index.js +3 -3
- package/dist/input.d.ts +6 -2
- package/dist/input.js +2 -2
- package/dist/prompt.js +3 -3
- package/package.json +1 -1
package/dist/error.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Command action function.
|
|
3
3
|
*/
|
|
4
|
-
declare type ActionFn<T extends Input> = (input: InferInput<T>) =>
|
|
4
|
+
declare type ActionFn<T extends Input> = (input: InferInput<T>) => any | Promise<any>;
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* A basic input type.
|
|
@@ -50,6 +50,10 @@ declare class Command<T extends Input = Input> {
|
|
|
50
50
|
* If this command allows unknown options.
|
|
51
51
|
*/
|
|
52
52
|
$allowUnknownOptions: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* If you should be able to surpass the amount of positional arguments defined in the input.
|
|
55
|
+
*/
|
|
56
|
+
$allowSurpassArgLimit: boolean;
|
|
53
57
|
/**
|
|
54
58
|
* The input this command takes.
|
|
55
59
|
*/
|
|
@@ -58,6 +62,10 @@ declare class Command<T extends Input = Input> {
|
|
|
58
62
|
* The action function of this command.
|
|
59
63
|
*/
|
|
60
64
|
$fn: ActionFn<T> | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The middlewares associated with this command.
|
|
67
|
+
*/
|
|
68
|
+
$middlewares: MiddlewareFn<T>[];
|
|
61
69
|
/**
|
|
62
70
|
* The error handler of this command.
|
|
63
71
|
*/
|
|
@@ -93,6 +101,12 @@ declare class Command<T extends Input = Input> {
|
|
|
93
101
|
* @returns this
|
|
94
102
|
*/
|
|
95
103
|
input<TInput extends Input>(input: TInput): Command<TInput>;
|
|
104
|
+
/**
|
|
105
|
+
* Adds a chain of middlewares.
|
|
106
|
+
* @param fns The middlewares to use.
|
|
107
|
+
* @returns this
|
|
108
|
+
*/
|
|
109
|
+
use(...fns: MiddlewareFn<T>[]): this;
|
|
96
110
|
/**
|
|
97
111
|
* Sets the action function for this command.
|
|
98
112
|
* @param fn The action.
|
|
@@ -136,6 +150,11 @@ declare class Command<T extends Input = Input> {
|
|
|
136
150
|
*/
|
|
137
151
|
parse(argv: string[]): Promise<ParseResult<T>>;
|
|
138
152
|
private buildInputMap;
|
|
153
|
+
/**
|
|
154
|
+
* Allows surpassing the amount of arguments specified.
|
|
155
|
+
* @returns this
|
|
156
|
+
*/
|
|
157
|
+
allowSurpassArgLimit(): this;
|
|
139
158
|
/**
|
|
140
159
|
* Gets the full command path (name including parents).
|
|
141
160
|
* @returns The full command path.
|
|
@@ -175,6 +194,46 @@ declare interface CommandAlias<T extends Input = Input> {
|
|
|
175
194
|
alias?: string;
|
|
176
195
|
}
|
|
177
196
|
|
|
197
|
+
/**
|
|
198
|
+
* A Convoker-related error. These are usually handled by default.
|
|
199
|
+
*/
|
|
200
|
+
export declare class ConvokerError extends Error {
|
|
201
|
+
/**
|
|
202
|
+
* The command this error happened on.
|
|
203
|
+
*/
|
|
204
|
+
command: Command<any>;
|
|
205
|
+
/**
|
|
206
|
+
* Creates a new Convoker error.
|
|
207
|
+
* @param message The message.
|
|
208
|
+
* @param command The command.
|
|
209
|
+
*/
|
|
210
|
+
constructor(message: string, command: Command<any>);
|
|
211
|
+
/**
|
|
212
|
+
* Prints the error's message.
|
|
213
|
+
*/
|
|
214
|
+
print(): void;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* A Convoker-related error. These are usually handled by default.
|
|
219
|
+
*/
|
|
220
|
+
declare class ConvokerError_2 extends Error {
|
|
221
|
+
/**
|
|
222
|
+
* The command this error happened on.
|
|
223
|
+
*/
|
|
224
|
+
command: Command<any>;
|
|
225
|
+
/**
|
|
226
|
+
* Creates a new Convoker error.
|
|
227
|
+
* @param message The message.
|
|
228
|
+
* @param command The command.
|
|
229
|
+
*/
|
|
230
|
+
constructor(message: string, command: Command<any>);
|
|
231
|
+
/**
|
|
232
|
+
* Prints the error's message.
|
|
233
|
+
*/
|
|
234
|
+
print(): void;
|
|
235
|
+
}
|
|
236
|
+
|
|
178
237
|
/**
|
|
179
238
|
* Command error handler.
|
|
180
239
|
*/
|
|
@@ -183,7 +242,7 @@ declare type ErrorFn<T extends Input> = (command: Command<T>, errors: Error[], i
|
|
|
183
242
|
/**
|
|
184
243
|
* When the user asks for help.
|
|
185
244
|
*/
|
|
186
|
-
export declare class HelpAskedError extends
|
|
245
|
+
export declare class HelpAskedError extends ConvokerError {
|
|
187
246
|
/**
|
|
188
247
|
* Creates a new help asked error.
|
|
189
248
|
* @param command The command.
|
|
@@ -240,46 +299,11 @@ declare type Kind = BasicKind | StandardSchemaV1<any, any>;
|
|
|
240
299
|
declare type Kind_2 = BasicKind_2 | StandardSchemaV1_2<any, any>;
|
|
241
300
|
|
|
242
301
|
/**
|
|
243
|
-
*
|
|
302
|
+
* Command middleware function.
|
|
244
303
|
*/
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* The command this error happened on.
|
|
248
|
-
*/
|
|
249
|
-
command: Command<any>;
|
|
250
|
-
/**
|
|
251
|
-
* Creates a new LunarCLI error.
|
|
252
|
-
* @param message The message.
|
|
253
|
-
* @param command The command.
|
|
254
|
-
*/
|
|
255
|
-
constructor(message: string, command: Command<any>);
|
|
256
|
-
/**
|
|
257
|
-
* Prints the error's message.
|
|
258
|
-
*/
|
|
259
|
-
print(): void;
|
|
260
|
-
}
|
|
304
|
+
declare type MiddlewareFn<T extends Input = Input> = (input: InferInput<T>, next: () => Promise<any>) => any | Promise<any>;
|
|
261
305
|
|
|
262
|
-
|
|
263
|
-
* A LunarCLI-related error. These are usually handled by default.
|
|
264
|
-
*/
|
|
265
|
-
declare class LunarCLIError_2 extends Error {
|
|
266
|
-
/**
|
|
267
|
-
* The command this error happened on.
|
|
268
|
-
*/
|
|
269
|
-
command: Command<any>;
|
|
270
|
-
/**
|
|
271
|
-
* Creates a new LunarCLI error.
|
|
272
|
-
* @param message The message.
|
|
273
|
-
* @param command The command.
|
|
274
|
-
*/
|
|
275
|
-
constructor(message: string, command: Command<any>);
|
|
276
|
-
/**
|
|
277
|
-
* Prints the error's message.
|
|
278
|
-
*/
|
|
279
|
-
print(): void;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
export declare class MissingRequiredArgumentError extends LunarCLIError {
|
|
306
|
+
export declare class MissingRequiredArgumentError extends ConvokerError {
|
|
283
307
|
/**
|
|
284
308
|
* The argument key.
|
|
285
309
|
*/
|
|
@@ -300,7 +324,7 @@ export declare class MissingRequiredArgumentError extends LunarCLIError {
|
|
|
300
324
|
/**
|
|
301
325
|
* When a required option is missing.
|
|
302
326
|
*/
|
|
303
|
-
export declare class MissingRequiredOptionError extends
|
|
327
|
+
export declare class MissingRequiredOptionError extends ConvokerError {
|
|
304
328
|
/**
|
|
305
329
|
* The option key.
|
|
306
330
|
*/
|
|
@@ -346,6 +370,10 @@ declare class Option_2<TKind extends Kind, TRequired extends boolean = true, TLi
|
|
|
346
370
|
* If this option is a list.
|
|
347
371
|
*/
|
|
348
372
|
$list: TList;
|
|
373
|
+
/**
|
|
374
|
+
* A separator if this option is a list.
|
|
375
|
+
*/
|
|
376
|
+
$separator: string | undefined;
|
|
349
377
|
/**
|
|
350
378
|
* Creates a new option.
|
|
351
379
|
* @param kind The type of this option.
|
|
@@ -356,7 +384,7 @@ declare class Option_2<TKind extends Kind, TRequired extends boolean = true, TLi
|
|
|
356
384
|
* Makes this option a list.
|
|
357
385
|
* @returns this
|
|
358
386
|
*/
|
|
359
|
-
list(): Option_2<TKind, TRequired, true>;
|
|
387
|
+
list(separator?: string): Option_2<TKind, TRequired, true>;
|
|
360
388
|
/**
|
|
361
389
|
* Makes this option required.
|
|
362
390
|
* @returns this
|
|
@@ -409,6 +437,10 @@ declare class Option_2_2<TKind extends Kind_2, TRequired extends boolean = true,
|
|
|
409
437
|
* If this option is a list.
|
|
410
438
|
*/
|
|
411
439
|
$list: TList;
|
|
440
|
+
/**
|
|
441
|
+
* A separator if this option is a list.
|
|
442
|
+
*/
|
|
443
|
+
$separator: string | undefined;
|
|
412
444
|
/**
|
|
413
445
|
* Creates a new option.
|
|
414
446
|
* @param kind The type of this option.
|
|
@@ -419,7 +451,7 @@ declare class Option_2_2<TKind extends Kind_2, TRequired extends boolean = true,
|
|
|
419
451
|
* Makes this option a list.
|
|
420
452
|
* @returns this
|
|
421
453
|
*/
|
|
422
|
-
list(): Option_2_2<TKind, TRequired, true>;
|
|
454
|
+
list(separator?: string): Option_2_2<TKind, TRequired, true>;
|
|
423
455
|
/**
|
|
424
456
|
* Makes this option required.
|
|
425
457
|
* @returns this
|
|
@@ -459,7 +491,7 @@ declare interface ParseResult<T extends Input> {
|
|
|
459
491
|
/**
|
|
460
492
|
* Errors collected during parsing.
|
|
461
493
|
*/
|
|
462
|
-
errors:
|
|
494
|
+
errors: ConvokerError_2[];
|
|
463
495
|
/**
|
|
464
496
|
* If this should result in displaying the version of the command.
|
|
465
497
|
*/
|
|
@@ -795,7 +827,7 @@ declare interface Theme {
|
|
|
795
827
|
/**
|
|
796
828
|
* When you pass too many arguments.
|
|
797
829
|
*/
|
|
798
|
-
export declare class TooManyArgumentsError extends
|
|
830
|
+
export declare class TooManyArgumentsError extends ConvokerError {
|
|
799
831
|
/**
|
|
800
832
|
* Creates a new too many arguments error.
|
|
801
833
|
* @param command The command.
|
|
@@ -816,7 +848,7 @@ declare type TypeOf_2<T extends Kind_2> = T extends StandardSchemaV1_2<any, infe
|
|
|
816
848
|
/**
|
|
817
849
|
* When you pass an unknown option, when unknown options aren't allowed.
|
|
818
850
|
*/
|
|
819
|
-
export declare class UnknownOptionError extends
|
|
851
|
+
export declare class UnknownOptionError extends ConvokerError {
|
|
820
852
|
/**
|
|
821
853
|
* The option key.
|
|
822
854
|
*/
|
package/dist/error.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as n, H as s, I as a, M as e, a as i, T as t, U as E } from "./chunks/error-CyKscMUD.js";
|
|
2
2
|
export {
|
|
3
|
-
n as
|
|
4
|
-
s as
|
|
5
|
-
a as
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
n as ConvokerError,
|
|
4
|
+
s as HelpAskedError,
|
|
5
|
+
a as InputValidationError,
|
|
6
|
+
e as MissingRequiredArgumentError,
|
|
7
|
+
i as MissingRequiredOptionError,
|
|
8
8
|
t as TooManyArgumentsError,
|
|
9
9
|
E as UnknownOptionError
|
|
10
10
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Theme as Theme_2 } from '../../../../../../../../../../src/color';
|
|
|
4
4
|
/**
|
|
5
5
|
* Command action function.
|
|
6
6
|
*/
|
|
7
|
-
export declare type ActionFn<T extends Input> = (input: InferInput<T>) =>
|
|
7
|
+
export declare type ActionFn<T extends Input> = (input: InferInput<T>) => any | Promise<any>;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Creates a new positional argument.
|
|
@@ -178,6 +178,10 @@ export declare class Command<T extends Input = Input> {
|
|
|
178
178
|
* If this command allows unknown options.
|
|
179
179
|
*/
|
|
180
180
|
$allowUnknownOptions: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* If you should be able to surpass the amount of positional arguments defined in the input.
|
|
183
|
+
*/
|
|
184
|
+
$allowSurpassArgLimit: boolean;
|
|
181
185
|
/**
|
|
182
186
|
* The input this command takes.
|
|
183
187
|
*/
|
|
@@ -186,6 +190,10 @@ export declare class Command<T extends Input = Input> {
|
|
|
186
190
|
* The action function of this command.
|
|
187
191
|
*/
|
|
188
192
|
$fn: ActionFn<T> | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* The middlewares associated with this command.
|
|
195
|
+
*/
|
|
196
|
+
$middlewares: MiddlewareFn<T>[];
|
|
189
197
|
/**
|
|
190
198
|
* The error handler of this command.
|
|
191
199
|
*/
|
|
@@ -221,6 +229,12 @@ export declare class Command<T extends Input = Input> {
|
|
|
221
229
|
* @returns this
|
|
222
230
|
*/
|
|
223
231
|
input<TInput extends Input>(input: TInput): Command<TInput>;
|
|
232
|
+
/**
|
|
233
|
+
* Adds a chain of middlewares.
|
|
234
|
+
* @param fns The middlewares to use.
|
|
235
|
+
* @returns this
|
|
236
|
+
*/
|
|
237
|
+
use(...fns: MiddlewareFn<T>[]): this;
|
|
224
238
|
/**
|
|
225
239
|
* Sets the action function for this command.
|
|
226
240
|
* @param fn The action.
|
|
@@ -264,6 +278,11 @@ export declare class Command<T extends Input = Input> {
|
|
|
264
278
|
*/
|
|
265
279
|
parse(argv: string[]): Promise<ParseResult<T>>;
|
|
266
280
|
private buildInputMap;
|
|
281
|
+
/**
|
|
282
|
+
* Allows surpassing the amount of arguments specified.
|
|
283
|
+
* @returns this
|
|
284
|
+
*/
|
|
285
|
+
allowSurpassArgLimit(): this;
|
|
267
286
|
/**
|
|
268
287
|
* Gets the full command path (name including parents).
|
|
269
288
|
* @returns The full command path.
|
|
@@ -330,7 +349,27 @@ declare interface ConfirmOpts extends BaseOpts<boolean> {
|
|
|
330
349
|
* @param value The value to convert.
|
|
331
350
|
* @returns The converted value.
|
|
332
351
|
*/
|
|
333
|
-
declare function convert<TKind extends Kind>(kind: TKind, value: string): Promise<TypeOf<TKind
|
|
352
|
+
declare function convert<TKind extends Kind>(kind: TKind, value: string | string[]): Promise<TypeOf<TKind> | TypeOf<TKind>[]>;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* A Convoker-related error. These are usually handled by default.
|
|
356
|
+
*/
|
|
357
|
+
declare class ConvokerError extends Error {
|
|
358
|
+
/**
|
|
359
|
+
* The command this error happened on.
|
|
360
|
+
*/
|
|
361
|
+
command: Command<any>;
|
|
362
|
+
/**
|
|
363
|
+
* Creates a new Convoker error.
|
|
364
|
+
* @param message The message.
|
|
365
|
+
* @param command The command.
|
|
366
|
+
*/
|
|
367
|
+
constructor(message: string, command: Command<any>);
|
|
368
|
+
/**
|
|
369
|
+
* Prints the error's message.
|
|
370
|
+
*/
|
|
371
|
+
print(): void;
|
|
372
|
+
}
|
|
334
373
|
|
|
335
374
|
/**
|
|
336
375
|
* Creates a function that wraps a string in ANSI codes.
|
|
@@ -398,7 +437,7 @@ declare interface EditorOpts extends BaseOpts<string> {
|
|
|
398
437
|
export declare namespace error {
|
|
399
438
|
export {
|
|
400
439
|
InputValidationError,
|
|
401
|
-
|
|
440
|
+
ConvokerError,
|
|
402
441
|
HelpAskedError,
|
|
403
442
|
TooManyArgumentsError,
|
|
404
443
|
UnknownOptionError,
|
|
@@ -433,7 +472,7 @@ declare const greenBright: (input: any) => string;
|
|
|
433
472
|
/**
|
|
434
473
|
* When the user asks for help.
|
|
435
474
|
*/
|
|
436
|
-
declare class HelpAskedError extends
|
|
475
|
+
declare class HelpAskedError extends ConvokerError {
|
|
437
476
|
/**
|
|
438
477
|
* Creates a new help asked error.
|
|
439
478
|
* @param command The command.
|
|
@@ -549,31 +588,16 @@ declare interface LogConfig {
|
|
|
549
588
|
stdin: ReadableStream<string>;
|
|
550
589
|
}
|
|
551
590
|
|
|
552
|
-
/**
|
|
553
|
-
* A LunarCLI-related error. These are usually handled by default.
|
|
554
|
-
*/
|
|
555
|
-
declare class LunarCLIError extends Error {
|
|
556
|
-
/**
|
|
557
|
-
* The command this error happened on.
|
|
558
|
-
*/
|
|
559
|
-
command: Command<any>;
|
|
560
|
-
/**
|
|
561
|
-
* Creates a new LunarCLI error.
|
|
562
|
-
* @param message The message.
|
|
563
|
-
* @param command The command.
|
|
564
|
-
*/
|
|
565
|
-
constructor(message: string, command: Command<any>);
|
|
566
|
-
/**
|
|
567
|
-
* Prints the error's message.
|
|
568
|
-
*/
|
|
569
|
-
print(): void;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
591
|
declare const magenta: (input: any) => string;
|
|
573
592
|
|
|
574
593
|
declare const magentaBright: (input: any) => string;
|
|
575
594
|
|
|
576
|
-
|
|
595
|
+
/**
|
|
596
|
+
* Command middleware function.
|
|
597
|
+
*/
|
|
598
|
+
export declare type MiddlewareFn<T extends Input = Input> = (input: InferInput<T>, next: () => Promise<any>) => any | Promise<any>;
|
|
599
|
+
|
|
600
|
+
declare class MissingRequiredArgumentError extends ConvokerError {
|
|
577
601
|
/**
|
|
578
602
|
* The argument key.
|
|
579
603
|
*/
|
|
@@ -594,7 +618,7 @@ declare class MissingRequiredArgumentError extends LunarCLIError {
|
|
|
594
618
|
/**
|
|
595
619
|
* When a required option is missing.
|
|
596
620
|
*/
|
|
597
|
-
declare class MissingRequiredOptionError extends
|
|
621
|
+
declare class MissingRequiredOptionError extends ConvokerError {
|
|
598
622
|
/**
|
|
599
623
|
* The option key.
|
|
600
624
|
*/
|
|
@@ -655,6 +679,10 @@ declare class Option_2<TKind extends Kind, TRequired extends boolean = true, TLi
|
|
|
655
679
|
* If this option is a list.
|
|
656
680
|
*/
|
|
657
681
|
$list: TList;
|
|
682
|
+
/**
|
|
683
|
+
* A separator if this option is a list.
|
|
684
|
+
*/
|
|
685
|
+
$separator: string | undefined;
|
|
658
686
|
/**
|
|
659
687
|
* Creates a new option.
|
|
660
688
|
* @param kind The type of this option.
|
|
@@ -665,7 +693,7 @@ declare class Option_2<TKind extends Kind, TRequired extends boolean = true, TLi
|
|
|
665
693
|
* Makes this option a list.
|
|
666
694
|
* @returns this
|
|
667
695
|
*/
|
|
668
|
-
list(): Option_2<TKind, TRequired, true>;
|
|
696
|
+
list(separator?: string): Option_2<TKind, TRequired, true>;
|
|
669
697
|
/**
|
|
670
698
|
* Makes this option required.
|
|
671
699
|
* @returns this
|
|
@@ -707,7 +735,7 @@ export declare interface ParseResult<T extends Input> {
|
|
|
707
735
|
/**
|
|
708
736
|
* Errors collected during parsing.
|
|
709
737
|
*/
|
|
710
|
-
errors:
|
|
738
|
+
errors: ConvokerError[];
|
|
711
739
|
/**
|
|
712
740
|
* If this should result in displaying the version of the command.
|
|
713
741
|
*/
|
|
@@ -1142,7 +1170,7 @@ declare interface Theme {
|
|
|
1142
1170
|
/**
|
|
1143
1171
|
* When you pass too many arguments.
|
|
1144
1172
|
*/
|
|
1145
|
-
declare class TooManyArgumentsError extends
|
|
1173
|
+
declare class TooManyArgumentsError extends ConvokerError {
|
|
1146
1174
|
/**
|
|
1147
1175
|
* Creates a new too many arguments error.
|
|
1148
1176
|
* @param command The command.
|
|
@@ -1166,7 +1194,7 @@ declare const underline: (input: any) => string;
|
|
|
1166
1194
|
/**
|
|
1167
1195
|
* When you pass an unknown option, when unknown options aren't allowed.
|
|
1168
1196
|
*/
|
|
1169
|
-
declare class UnknownOptionError extends
|
|
1197
|
+
declare class UnknownOptionError extends ConvokerError {
|
|
1170
1198
|
/**
|
|
1171
1199
|
* The option key.
|
|
1172
1200
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Command as m, l as e } from "./command.js";
|
|
2
|
-
import { e as a } from "./chunks/error-
|
|
3
|
-
import { i as f } from "./chunks/input-
|
|
2
|
+
import { e as a } from "./chunks/error-CyKscMUD.js";
|
|
3
|
+
import { i as f } from "./chunks/input-WNu16aNE.js";
|
|
4
4
|
import { a as s } from "./chunks/color-CiruG_zQ.js";
|
|
5
|
-
import { i } from "./chunks/index-
|
|
5
|
+
import { i } from "./chunks/index-BluQjWvw.js";
|
|
6
6
|
export {
|
|
7
7
|
m as Command,
|
|
8
8
|
s as color,
|
package/dist/input.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare type BasicKind = "boolean" | "string" | "number" | "bigint";
|
|
|
16
16
|
* @param value The value to convert.
|
|
17
17
|
* @returns The converted value.
|
|
18
18
|
*/
|
|
19
|
-
export declare function convert<TKind extends Kind>(kind: TKind, value: string): Promise<TypeOf<TKind
|
|
19
|
+
export declare function convert<TKind extends Kind>(kind: TKind, value: string | string[]): Promise<TypeOf<TKind> | TypeOf<TKind>[]>;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Infers a TypeScript type from an option or positional.
|
|
@@ -82,6 +82,10 @@ declare class Option_2<TKind extends Kind, TRequired extends boolean = true, TLi
|
|
|
82
82
|
* If this option is a list.
|
|
83
83
|
*/
|
|
84
84
|
$list: TList;
|
|
85
|
+
/**
|
|
86
|
+
* A separator if this option is a list.
|
|
87
|
+
*/
|
|
88
|
+
$separator: string | undefined;
|
|
85
89
|
/**
|
|
86
90
|
* Creates a new option.
|
|
87
91
|
* @param kind The type of this option.
|
|
@@ -92,7 +96,7 @@ declare class Option_2<TKind extends Kind, TRequired extends boolean = true, TLi
|
|
|
92
96
|
* Makes this option a list.
|
|
93
97
|
* @returns this
|
|
94
98
|
*/
|
|
95
|
-
list(): Option_2<TKind, TRequired, true>;
|
|
99
|
+
list(separator?: string): Option_2<TKind, TRequired, true>;
|
|
96
100
|
/**
|
|
97
101
|
* Makes this option required.
|
|
98
102
|
* @returns this
|
package/dist/input.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./chunks/standard-schema-
|
|
2
|
-
import { O as t, P as i, a as n, c as p, o as r, p as e } from "./chunks/input-
|
|
1
|
+
import "./chunks/standard-schema-BHKzvwIS.js";
|
|
2
|
+
import { O as t, P as i, a as n, c as p, o as r, p as e } from "./chunks/input-WNu16aNE.js";
|
|
3
3
|
export {
|
|
4
4
|
t as Option,
|
|
5
5
|
i as Positional,
|
package/dist/prompt.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./chunks/color-CiruG_zQ.js";
|
|
2
|
-
import "./chunks/standard-schema-
|
|
3
|
-
import "./chunks/error-
|
|
2
|
+
import "./chunks/standard-schema-BHKzvwIS.js";
|
|
3
|
+
import "./chunks/error-CyKscMUD.js";
|
|
4
4
|
import "./chunks/utils-DdmSEjLc.js";
|
|
5
5
|
import { d as m } from "./chunks/__vite-browser-external-DQYBmsno.js";
|
|
6
|
-
import { c as i, e as c, m as d, p as f, b as l, a as x, s as h, t as w } from "./chunks/index-
|
|
6
|
+
import { c as i, e as c, m as d, p as f, b as l, a as x, s as h, t as w } from "./chunks/index-BluQjWvw.js";
|
|
7
7
|
export {
|
|
8
8
|
i as confirm,
|
|
9
9
|
c as editor,
|