convoker 0.1.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/LICENSE +21 -0
- package/README.md +34 -0
- package/dist/chunks/__vite-browser-external-DQYBmsno.js +80 -0
- package/dist/chunks/color-CiruG_zQ.js +153 -0
- package/dist/chunks/error-Cj2qDfOl.js +95 -0
- package/dist/chunks/index-G2nVXKup.js +198 -0
- package/dist/chunks/input-COjWPD53.js +135 -0
- package/dist/chunks/standard-schema-Dn3nwAxU.js +12 -0
- package/dist/chunks/utils-DdmSEjLc.js +22 -0
- package/dist/color.d.ts +200 -0
- package/dist/color.js +49 -0
- package/dist/command.d.ts +527 -0
- package/dist/command.js +415 -0
- package/dist/error.d.ts +832 -0
- package/dist/error.js +10 -0
- package/dist/index.d.ts +1196 -0
- package/dist/index.js +13 -0
- package/dist/input.d.ts +248 -0
- package/dist/input.js +10 -0
- package/dist/prompt/raw.d.ts +32 -0
- package/dist/prompt/raw.js +9 -0
- package/dist/prompt.d.ts +258 -0
- package/dist/prompt.js +17 -0
- package/dist/raw.d.ts +38 -0
- package/package.json +70 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1196 @@
|
|
|
1
|
+
import { StandardSchemaV1 as StandardSchemaV1_2 } from '../../../../../../../../../../src/standard-schema';
|
|
2
|
+
import { Theme as Theme_2 } from '../../../../../../../../../../src/color';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Command action function.
|
|
6
|
+
*/
|
|
7
|
+
export declare type ActionFn<T extends Input> = (input: InferInput<T>) => void | Promise<void>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new positional argument.
|
|
11
|
+
* @param kind The kind of positional argument.
|
|
12
|
+
* @returns A new positional argument.
|
|
13
|
+
*/
|
|
14
|
+
declare function argument<T extends Kind>(kind: T): Positional<T>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Base options for prompts.
|
|
18
|
+
*/
|
|
19
|
+
declare interface BaseOpts<T> {
|
|
20
|
+
/**
|
|
21
|
+
* The message of the prompt.
|
|
22
|
+
*/
|
|
23
|
+
message: string;
|
|
24
|
+
/**
|
|
25
|
+
* An `AbortSignal` to cancel the prompt.
|
|
26
|
+
*/
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
/**
|
|
29
|
+
* The default value.
|
|
30
|
+
*/
|
|
31
|
+
default?: T;
|
|
32
|
+
/**
|
|
33
|
+
* The theme of the prompt.
|
|
34
|
+
*/
|
|
35
|
+
theme?: Theme_2;
|
|
36
|
+
/**
|
|
37
|
+
* A validator function, or a Standard Schema validator.
|
|
38
|
+
*/
|
|
39
|
+
validate?: StandardSchemaV1_2<any, T> | ((value: T) => boolean | T);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A basic input type.
|
|
44
|
+
*/
|
|
45
|
+
declare type BasicKind = "boolean" | "string" | "number" | "bigint";
|
|
46
|
+
|
|
47
|
+
declare const bgBlack: (input: any) => string;
|
|
48
|
+
|
|
49
|
+
declare const bgBlue: (input: any) => string;
|
|
50
|
+
|
|
51
|
+
declare const bgBlueBright: (input: any) => string;
|
|
52
|
+
|
|
53
|
+
declare const bgCyan: (input: any) => string;
|
|
54
|
+
|
|
55
|
+
declare const bgCyanBright: (input: any) => string;
|
|
56
|
+
|
|
57
|
+
declare const bgGray: (input: any) => string;
|
|
58
|
+
|
|
59
|
+
declare const bgGreen: (input: any) => string;
|
|
60
|
+
|
|
61
|
+
declare const bgGreenBright: (input: any) => string;
|
|
62
|
+
|
|
63
|
+
declare const bgMagenta: (input: any) => string;
|
|
64
|
+
|
|
65
|
+
declare const bgMagentaBright: (input: any) => string;
|
|
66
|
+
|
|
67
|
+
declare const bgRed: (input: any) => string;
|
|
68
|
+
|
|
69
|
+
declare const bgRedBright: (input: any) => string;
|
|
70
|
+
|
|
71
|
+
declare const bgWhite: (input: any) => string;
|
|
72
|
+
|
|
73
|
+
declare const bgWhiteBright: (input: any) => string;
|
|
74
|
+
|
|
75
|
+
declare const bgYellow: (input: any) => string;
|
|
76
|
+
|
|
77
|
+
declare const bgYellowBright: (input: any) => string;
|
|
78
|
+
|
|
79
|
+
declare const black: (input: any) => string;
|
|
80
|
+
|
|
81
|
+
declare const blue: (input: any) => string;
|
|
82
|
+
|
|
83
|
+
declare const blueBright: (input: any) => string;
|
|
84
|
+
|
|
85
|
+
declare const bold: (input: any) => string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Builder for commands.
|
|
89
|
+
*/
|
|
90
|
+
export declare type Builder = (c: Command<any>) => Command<any> | void;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Clears `lines` amount of lines.
|
|
94
|
+
* @param lines Amount of lines to clear.
|
|
95
|
+
*/
|
|
96
|
+
declare function clearLines(lines?: number): void;
|
|
97
|
+
|
|
98
|
+
export declare namespace color {
|
|
99
|
+
export {
|
|
100
|
+
createAnsiColor,
|
|
101
|
+
defineTheme,
|
|
102
|
+
supportsColor,
|
|
103
|
+
reset,
|
|
104
|
+
bold,
|
|
105
|
+
dim,
|
|
106
|
+
italic,
|
|
107
|
+
underline,
|
|
108
|
+
overline,
|
|
109
|
+
inverse,
|
|
110
|
+
hidden,
|
|
111
|
+
strikethrough,
|
|
112
|
+
black,
|
|
113
|
+
red,
|
|
114
|
+
green,
|
|
115
|
+
yellow,
|
|
116
|
+
blue,
|
|
117
|
+
magenta,
|
|
118
|
+
cyan,
|
|
119
|
+
white,
|
|
120
|
+
gray,
|
|
121
|
+
bgBlack,
|
|
122
|
+
bgRed,
|
|
123
|
+
bgGreen,
|
|
124
|
+
bgYellow,
|
|
125
|
+
bgBlue,
|
|
126
|
+
bgMagenta,
|
|
127
|
+
bgCyan,
|
|
128
|
+
bgWhite,
|
|
129
|
+
bgGray,
|
|
130
|
+
redBright,
|
|
131
|
+
greenBright,
|
|
132
|
+
yellowBright,
|
|
133
|
+
blueBright,
|
|
134
|
+
magentaBright,
|
|
135
|
+
cyanBright,
|
|
136
|
+
whiteBright,
|
|
137
|
+
bgRedBright,
|
|
138
|
+
bgGreenBright,
|
|
139
|
+
bgYellowBright,
|
|
140
|
+
bgBlueBright,
|
|
141
|
+
bgMagentaBright,
|
|
142
|
+
bgCyanBright,
|
|
143
|
+
bgWhiteBright,
|
|
144
|
+
Theme,
|
|
145
|
+
DEFAULT_THEME
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* A command.
|
|
151
|
+
*/
|
|
152
|
+
export declare class Command<T extends Input = Input> {
|
|
153
|
+
/**
|
|
154
|
+
* The names (aliases) of this command.
|
|
155
|
+
*/
|
|
156
|
+
$names: string[];
|
|
157
|
+
/**
|
|
158
|
+
* The description of this command.
|
|
159
|
+
*/
|
|
160
|
+
$description: string | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* The theme of this command
|
|
163
|
+
*/
|
|
164
|
+
$theme: Theme | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* The version of this command.
|
|
167
|
+
*/
|
|
168
|
+
$version: string | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* The children of this command.
|
|
171
|
+
*/
|
|
172
|
+
$children: Map<string, CommandAlias>;
|
|
173
|
+
/**
|
|
174
|
+
* The parent of this command.
|
|
175
|
+
*/
|
|
176
|
+
$parent: Command<any> | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* If this command allows unknown options.
|
|
179
|
+
*/
|
|
180
|
+
$allowUnknownOptions: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* The input this command takes.
|
|
183
|
+
*/
|
|
184
|
+
$input: T;
|
|
185
|
+
/**
|
|
186
|
+
* The action function of this command.
|
|
187
|
+
*/
|
|
188
|
+
$fn: ActionFn<T> | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* The error handler of this command.
|
|
191
|
+
*/
|
|
192
|
+
$errorFn: ErrorFn<T> | undefined;
|
|
193
|
+
/**
|
|
194
|
+
* Creates a new command.
|
|
195
|
+
* @param names The names (aliases).
|
|
196
|
+
* @param desc The description.
|
|
197
|
+
* @param version The version.
|
|
198
|
+
*/
|
|
199
|
+
constructor(names: string | string[], desc?: string, version?: string);
|
|
200
|
+
/**
|
|
201
|
+
* Adds a set of aliases to this command.
|
|
202
|
+
* @param aliases The aliases to add.
|
|
203
|
+
* @returns this
|
|
204
|
+
*/
|
|
205
|
+
alias(...aliases: string[]): this;
|
|
206
|
+
/**
|
|
207
|
+
* Adds a description to this command.
|
|
208
|
+
* @param desc The description.
|
|
209
|
+
* @returns this
|
|
210
|
+
*/
|
|
211
|
+
description(desc: string): this;
|
|
212
|
+
/**
|
|
213
|
+
* Adds a version to this command.
|
|
214
|
+
* @param version The version.
|
|
215
|
+
* @returns this
|
|
216
|
+
*/
|
|
217
|
+
version(version: string): this;
|
|
218
|
+
/**
|
|
219
|
+
* Sets the input for this command.
|
|
220
|
+
* @param version The input.
|
|
221
|
+
* @returns this
|
|
222
|
+
*/
|
|
223
|
+
input<TInput extends Input>(input: TInput): Command<TInput>;
|
|
224
|
+
/**
|
|
225
|
+
* Sets the action function for this command.
|
|
226
|
+
* @param fn The action.
|
|
227
|
+
* @returns this
|
|
228
|
+
*/
|
|
229
|
+
action(fn: ActionFn<T>): this;
|
|
230
|
+
/**
|
|
231
|
+
* Sets the error function for this command.
|
|
232
|
+
* @param fn The error handler.
|
|
233
|
+
* @returns this
|
|
234
|
+
*/
|
|
235
|
+
error(fn: ErrorFn<T>): this;
|
|
236
|
+
/**
|
|
237
|
+
* Adds an existing command to this.
|
|
238
|
+
* @param command The command.
|
|
239
|
+
* @returns this
|
|
240
|
+
*/
|
|
241
|
+
add(command: Command<any>): this;
|
|
242
|
+
/**
|
|
243
|
+
* Creates a new subcommand and adds it.
|
|
244
|
+
* @param names The aliases of the subcommand.
|
|
245
|
+
* @param builder A builder to create the command.
|
|
246
|
+
*/
|
|
247
|
+
subCommand(names: string | string[], builder: Builder): this;
|
|
248
|
+
/**
|
|
249
|
+
* Creates a new subcommand and adds it.
|
|
250
|
+
* @param names The aliases of the subcommand.
|
|
251
|
+
* @param desc The description of the subcommand.
|
|
252
|
+
* @param version The version of the subcommand.
|
|
253
|
+
*/
|
|
254
|
+
subCommand(names: string | string[], desc?: string, version?: string): Command<any>;
|
|
255
|
+
/**
|
|
256
|
+
* Allows unknown options.
|
|
257
|
+
* @returns this
|
|
258
|
+
*/
|
|
259
|
+
allowUnknownOptions(): this;
|
|
260
|
+
/**
|
|
261
|
+
* Parses a set of command-line arguments.
|
|
262
|
+
* @param argv The arguments to parse.
|
|
263
|
+
* @returns A parse result.
|
|
264
|
+
*/
|
|
265
|
+
parse(argv: string[]): Promise<ParseResult<T>>;
|
|
266
|
+
private buildInputMap;
|
|
267
|
+
/**
|
|
268
|
+
* Gets the full command path (name including parents).
|
|
269
|
+
* @returns The full command path.
|
|
270
|
+
*/
|
|
271
|
+
fullCommandPath(): string;
|
|
272
|
+
/**
|
|
273
|
+
* The default error screen.
|
|
274
|
+
* @param errors The errors.
|
|
275
|
+
*/
|
|
276
|
+
defaultErrorScreen(errors: Error[]): void;
|
|
277
|
+
/**
|
|
278
|
+
* Handles a set of errors.
|
|
279
|
+
* @param errors The errors to handle.
|
|
280
|
+
* @param input The parsed input, if possible.
|
|
281
|
+
* @returns this
|
|
282
|
+
*/
|
|
283
|
+
handleErrors(errors: Error[], input?: Partial<InferInput<T>>): Promise<this>;
|
|
284
|
+
/**
|
|
285
|
+
* Runs a command.
|
|
286
|
+
* @param argv The arguments to run the command with. Defaults to your runtime's `argv` equivalent.
|
|
287
|
+
* @returns this
|
|
288
|
+
*/
|
|
289
|
+
run(argv?: string[]): Promise<this>;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* What the command is an alias for.
|
|
294
|
+
*/
|
|
295
|
+
export declare interface CommandAlias<T extends Input = Input> {
|
|
296
|
+
/**
|
|
297
|
+
* A pointer to the command.
|
|
298
|
+
*/
|
|
299
|
+
command: Command<T>;
|
|
300
|
+
/**
|
|
301
|
+
* The name of the command this is an alias for.
|
|
302
|
+
*/
|
|
303
|
+
alias?: string;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Prompts the user to confirm an action.
|
|
308
|
+
* @param opts Options for confirm input.
|
|
309
|
+
* @returns If the user picked Yes.
|
|
310
|
+
*/
|
|
311
|
+
declare function confirm_2(opts: ConfirmOpts): Promise<boolean>;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Options for confirm input.
|
|
315
|
+
*/
|
|
316
|
+
declare interface ConfirmOpts extends BaseOpts<boolean> {
|
|
317
|
+
/**
|
|
318
|
+
* What gets displayed for the Yes option.
|
|
319
|
+
*/
|
|
320
|
+
yesLabel?: string;
|
|
321
|
+
/**
|
|
322
|
+
* What gets displayed for the No option.
|
|
323
|
+
*/
|
|
324
|
+
noLabel?: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Converts a value from a Kind to a TypeScript type.
|
|
329
|
+
* @param kind The kind to convert to.
|
|
330
|
+
* @param value The value to convert.
|
|
331
|
+
* @returns The converted value.
|
|
332
|
+
*/
|
|
333
|
+
declare function convert<TKind extends Kind>(kind: TKind, value: string): Promise<TypeOf<TKind>>;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Creates a function that wraps a string in ANSI codes.
|
|
337
|
+
* @param open The opening ANSI code.
|
|
338
|
+
* @param close The closing ANSI code.
|
|
339
|
+
* @returns A function that wraps the string in ANSI codes.
|
|
340
|
+
*/
|
|
341
|
+
declare function createAnsiColor(open: number, close: number): (input: any) => string;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Moves the cursor down `n` times.
|
|
345
|
+
* @param n The amount of steps to move.
|
|
346
|
+
*/
|
|
347
|
+
declare function cursorDown(n?: number): void;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Moves the cursor up `n` times.
|
|
351
|
+
* @param n The amount of steps to move.
|
|
352
|
+
*/
|
|
353
|
+
declare function cursorUp(n?: number): void;
|
|
354
|
+
|
|
355
|
+
declare const cyan: (input: any) => string;
|
|
356
|
+
|
|
357
|
+
declare const cyanBright: (input: any) => string;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* The default theme.
|
|
361
|
+
*/
|
|
362
|
+
declare const DEFAULT_THEME: Theme;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Defines a theme.
|
|
366
|
+
* @param theme The (partial) theme.
|
|
367
|
+
* @returns The theme, merged with the default theme.
|
|
368
|
+
*/
|
|
369
|
+
declare function defineTheme(theme: Partial<Theme>): Theme;
|
|
370
|
+
|
|
371
|
+
declare const dim: (input: any) => string;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Opens the system editor, or asks for input in the terminal as fallback.
|
|
375
|
+
* @param opts Options for opening the system editor.
|
|
376
|
+
* @returns The result of the system editor.
|
|
377
|
+
*/
|
|
378
|
+
declare function editor(opts: EditorOpts): Promise<string>;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Options for opening the system editor.
|
|
382
|
+
*/
|
|
383
|
+
declare interface EditorOpts extends BaseOpts<string> {
|
|
384
|
+
/**
|
|
385
|
+
* The initial value.
|
|
386
|
+
*/
|
|
387
|
+
initial?: string;
|
|
388
|
+
/**
|
|
389
|
+
* The language of the value.
|
|
390
|
+
*/
|
|
391
|
+
language?: string;
|
|
392
|
+
/**
|
|
393
|
+
* If the input is required for continuing or not.
|
|
394
|
+
*/
|
|
395
|
+
required?: boolean;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
export declare namespace error {
|
|
399
|
+
export {
|
|
400
|
+
InputValidationError,
|
|
401
|
+
LunarCLIError,
|
|
402
|
+
HelpAskedError,
|
|
403
|
+
TooManyArgumentsError,
|
|
404
|
+
UnknownOptionError,
|
|
405
|
+
MissingRequiredOptionError,
|
|
406
|
+
MissingRequiredArgumentError
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Prints errors.
|
|
412
|
+
* @param msgs The messages to write.
|
|
413
|
+
*/
|
|
414
|
+
declare function error_2(...msgs: any[]): Promise<void>;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Command error handler.
|
|
418
|
+
*/
|
|
419
|
+
export declare type ErrorFn<T extends Input> = (command: Command<T>, errors: Error[], input: Partial<InferInput<T>>) => void | Promise<void>;
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Prints errors and exits.
|
|
423
|
+
* @param msgs The messages to write.
|
|
424
|
+
*/
|
|
425
|
+
declare function fatal(...msgs: any[]): Promise<void>;
|
|
426
|
+
|
|
427
|
+
declare const gray: (input: any) => string;
|
|
428
|
+
|
|
429
|
+
declare const green: (input: any) => string;
|
|
430
|
+
|
|
431
|
+
declare const greenBright: (input: any) => string;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* When the user asks for help.
|
|
435
|
+
*/
|
|
436
|
+
declare class HelpAskedError extends LunarCLIError {
|
|
437
|
+
/**
|
|
438
|
+
* Creates a new help asked error.
|
|
439
|
+
* @param command The command.
|
|
440
|
+
*/
|
|
441
|
+
constructor(command: Command<any>);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
declare const hidden: (input: any) => string;
|
|
445
|
+
|
|
446
|
+
export declare namespace i {
|
|
447
|
+
export {
|
|
448
|
+
convert,
|
|
449
|
+
option,
|
|
450
|
+
positional,
|
|
451
|
+
argument,
|
|
452
|
+
Input,
|
|
453
|
+
BasicKind,
|
|
454
|
+
Kind,
|
|
455
|
+
TypeOf,
|
|
456
|
+
InferInput,
|
|
457
|
+
InferEntry,
|
|
458
|
+
Option_2 as Option,
|
|
459
|
+
Positional
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Infers a TypeScript type from an option or positional.
|
|
465
|
+
*/
|
|
466
|
+
declare type InferEntry<T> = T extends {
|
|
467
|
+
$kind: infer TKind extends Kind;
|
|
468
|
+
$required: infer Required;
|
|
469
|
+
$list: infer List;
|
|
470
|
+
} ? List extends true ? Required extends true ? TypeOf<TKind>[] : TypeOf<TKind>[] | undefined : Required extends true ? TypeOf<TKind> : TypeOf<TKind> | undefined : never;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Infers TypeScript types from an input object.
|
|
474
|
+
*/
|
|
475
|
+
declare type InferInput<T extends Input> = {
|
|
476
|
+
[K in keyof T]: InferEntry<T[K]>;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Prints information.
|
|
481
|
+
* @param msgs The messages to write.
|
|
482
|
+
*/
|
|
483
|
+
declare function info(...msgs: any[]): Promise<void>;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* An input object.
|
|
487
|
+
*/
|
|
488
|
+
declare interface Input {
|
|
489
|
+
[x: string]: Option_2<any, any, any> | Positional<any, any, any>;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Thrown when the command fails to validate an input.
|
|
494
|
+
*/
|
|
495
|
+
declare class InputValidationError extends Error {
|
|
496
|
+
/**
|
|
497
|
+
* A list of messages.
|
|
498
|
+
*/
|
|
499
|
+
messages: string[];
|
|
500
|
+
/**
|
|
501
|
+
* Creates a new input validation error.
|
|
502
|
+
* @param messages The messages.
|
|
503
|
+
*/
|
|
504
|
+
constructor(messages: string[]);
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
declare const inverse: (input: any) => string;
|
|
508
|
+
|
|
509
|
+
declare const italic: (input: any) => string;
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* An input type.
|
|
513
|
+
*/
|
|
514
|
+
declare type Kind = BasicKind | StandardSchemaV1<any, any>;
|
|
515
|
+
|
|
516
|
+
export declare namespace log {
|
|
517
|
+
export {
|
|
518
|
+
setTheme_2 as setTheme,
|
|
519
|
+
setConfig,
|
|
520
|
+
setup,
|
|
521
|
+
trace,
|
|
522
|
+
info,
|
|
523
|
+
warn,
|
|
524
|
+
error_2 as error,
|
|
525
|
+
fatal,
|
|
526
|
+
LogConfig
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* The logger configuration.
|
|
532
|
+
*/
|
|
533
|
+
declare interface LogConfig {
|
|
534
|
+
/**
|
|
535
|
+
* The format to print as.
|
|
536
|
+
*/
|
|
537
|
+
format: "text" | "json" | "xml" | "yaml" | "csv";
|
|
538
|
+
/**
|
|
539
|
+
* Standard output.
|
|
540
|
+
*/
|
|
541
|
+
stdout: WritableStream<string>;
|
|
542
|
+
/**
|
|
543
|
+
* Standard error.
|
|
544
|
+
*/
|
|
545
|
+
stderr: WritableStream<string>;
|
|
546
|
+
/**
|
|
547
|
+
* Standard input.
|
|
548
|
+
*/
|
|
549
|
+
stdin: ReadableStream<string>;
|
|
550
|
+
}
|
|
551
|
+
|
|
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
|
+
declare const magenta: (input: any) => string;
|
|
573
|
+
|
|
574
|
+
declare const magentaBright: (input: any) => string;
|
|
575
|
+
|
|
576
|
+
declare class MissingRequiredArgumentError extends LunarCLIError {
|
|
577
|
+
/**
|
|
578
|
+
* The argument key.
|
|
579
|
+
*/
|
|
580
|
+
key: string;
|
|
581
|
+
/**
|
|
582
|
+
* The argument entry.
|
|
583
|
+
*/
|
|
584
|
+
entry: Positional<any, any, any>;
|
|
585
|
+
/**
|
|
586
|
+
* Creates a new missing required argument error.
|
|
587
|
+
* @param command The command.
|
|
588
|
+
* @param key The key.
|
|
589
|
+
* @param entry The entry.
|
|
590
|
+
*/
|
|
591
|
+
constructor(command: Command<any>, key: string, entry: Positional<any, any, any>);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* When a required option is missing.
|
|
596
|
+
*/
|
|
597
|
+
declare class MissingRequiredOptionError extends LunarCLIError {
|
|
598
|
+
/**
|
|
599
|
+
* The option key.
|
|
600
|
+
*/
|
|
601
|
+
key: string;
|
|
602
|
+
/**
|
|
603
|
+
* The option entry.
|
|
604
|
+
*/
|
|
605
|
+
entry: Option_2<any, any, any>;
|
|
606
|
+
/**
|
|
607
|
+
* Creates a new missing required option error.
|
|
608
|
+
* @param command The command.
|
|
609
|
+
* @param key The key.
|
|
610
|
+
* @param entry The entry.
|
|
611
|
+
*/
|
|
612
|
+
constructor(command: Command<any>, key: string, entry: Option_2<any, any, any>);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Prompts the user to select multiple options.
|
|
617
|
+
* @param opts Options for select input.
|
|
618
|
+
* @returns The selected options.
|
|
619
|
+
*/
|
|
620
|
+
declare function multiselect<T>(opts: SelectOpts<T>): Promise<T[]>;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Creates a new option.
|
|
624
|
+
* @param kind The kind of option.
|
|
625
|
+
* @param names The names of the option.
|
|
626
|
+
* @returns A new option.
|
|
627
|
+
*/
|
|
628
|
+
declare function option<T extends Kind>(kind: T, ...names: string[]): Option_2<T>;
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* An option.
|
|
632
|
+
*/
|
|
633
|
+
declare class Option_2<TKind extends Kind, TRequired extends boolean = true, TList extends boolean = false> {
|
|
634
|
+
/**
|
|
635
|
+
* The kind of this option.
|
|
636
|
+
*/
|
|
637
|
+
$kind: TKind;
|
|
638
|
+
/**
|
|
639
|
+
* The aliases of this option.
|
|
640
|
+
*/
|
|
641
|
+
$names: string[];
|
|
642
|
+
/**
|
|
643
|
+
* The description of this option.
|
|
644
|
+
*/
|
|
645
|
+
$description: string | undefined;
|
|
646
|
+
/**
|
|
647
|
+
* The default value of this option.
|
|
648
|
+
*/
|
|
649
|
+
$default: TypeOf<TKind> | undefined;
|
|
650
|
+
/**
|
|
651
|
+
* If this option is required.
|
|
652
|
+
*/
|
|
653
|
+
$required: TRequired;
|
|
654
|
+
/**
|
|
655
|
+
* If this option is a list.
|
|
656
|
+
*/
|
|
657
|
+
$list: TList;
|
|
658
|
+
/**
|
|
659
|
+
* Creates a new option.
|
|
660
|
+
* @param kind The type of this option.
|
|
661
|
+
* @param names The names of this option.
|
|
662
|
+
*/
|
|
663
|
+
constructor(kind: TKind, names: string[]);
|
|
664
|
+
/**
|
|
665
|
+
* Makes this option a list.
|
|
666
|
+
* @returns this
|
|
667
|
+
*/
|
|
668
|
+
list(): Option_2<TKind, TRequired, true>;
|
|
669
|
+
/**
|
|
670
|
+
* Makes this option required.
|
|
671
|
+
* @returns this
|
|
672
|
+
*/
|
|
673
|
+
required(): Option_2<TKind, true, TList>;
|
|
674
|
+
/**
|
|
675
|
+
* Makes this option optional.
|
|
676
|
+
* @returns this
|
|
677
|
+
*/
|
|
678
|
+
optional(): Option_2<TKind, false, TList>;
|
|
679
|
+
/**
|
|
680
|
+
* Sets a default value.
|
|
681
|
+
* @param value The default value.
|
|
682
|
+
* @returns this
|
|
683
|
+
*/
|
|
684
|
+
default(value: TypeOf<TKind>): this;
|
|
685
|
+
/**
|
|
686
|
+
* Sets a description.
|
|
687
|
+
* @param desc The description.
|
|
688
|
+
* @returns this
|
|
689
|
+
*/
|
|
690
|
+
description(desc: string): this;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
declare const overline: (input: any) => string;
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* The result of the `Command.parse` function.
|
|
697
|
+
*/
|
|
698
|
+
export declare interface ParseResult<T extends Input> {
|
|
699
|
+
/**
|
|
700
|
+
* A pointer to the command to run.
|
|
701
|
+
*/
|
|
702
|
+
command: Command<T>;
|
|
703
|
+
/**
|
|
704
|
+
* The input to pass into the command.
|
|
705
|
+
*/
|
|
706
|
+
input: InferInput<T>;
|
|
707
|
+
/**
|
|
708
|
+
* Errors collected during parsing.
|
|
709
|
+
*/
|
|
710
|
+
errors: LunarCLIError[];
|
|
711
|
+
/**
|
|
712
|
+
* If this should result in displaying the version of the command.
|
|
713
|
+
*/
|
|
714
|
+
isVersion: boolean;
|
|
715
|
+
/**
|
|
716
|
+
* If this should result in displaying a help screen.
|
|
717
|
+
*/
|
|
718
|
+
isHelp: boolean;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Prompts the user for a password.
|
|
723
|
+
* @param opts Options for password input.
|
|
724
|
+
* @returns The password.
|
|
725
|
+
*/
|
|
726
|
+
declare function password(opts: PasswordOpts): Promise<string>;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Options for password input.
|
|
730
|
+
*/
|
|
731
|
+
declare interface PasswordOpts extends TextOpts {
|
|
732
|
+
/**
|
|
733
|
+
* The mask for the password input.
|
|
734
|
+
*/
|
|
735
|
+
mask?: string;
|
|
736
|
+
/**
|
|
737
|
+
* If the user should be asked to confirm the password, by typing it again.
|
|
738
|
+
*/
|
|
739
|
+
confirm?: boolean;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
/**
|
|
743
|
+
* A positional argument.
|
|
744
|
+
*/
|
|
745
|
+
declare class Positional<TKind extends Kind, TRequired extends boolean = true, TList extends boolean = false> {
|
|
746
|
+
/**
|
|
747
|
+
* The type of this argument.
|
|
748
|
+
*/
|
|
749
|
+
$kind: TKind;
|
|
750
|
+
/**
|
|
751
|
+
* The default value of this argument.
|
|
752
|
+
*/
|
|
753
|
+
$default: TypeOf<TKind> | undefined;
|
|
754
|
+
/**
|
|
755
|
+
* The description of this argument.
|
|
756
|
+
*/
|
|
757
|
+
$description: string | undefined;
|
|
758
|
+
/**
|
|
759
|
+
* If this argument is required.
|
|
760
|
+
*/
|
|
761
|
+
$required: TRequired;
|
|
762
|
+
/**
|
|
763
|
+
* If this argument is a list.
|
|
764
|
+
*/
|
|
765
|
+
$list: TList;
|
|
766
|
+
/**
|
|
767
|
+
* Creates a new positional argument.
|
|
768
|
+
* @param kind The positional argument.
|
|
769
|
+
*/
|
|
770
|
+
constructor(kind: TKind);
|
|
771
|
+
/**
|
|
772
|
+
* Makes this argument a list.
|
|
773
|
+
* @returns this
|
|
774
|
+
*/
|
|
775
|
+
list(): Positional<TKind, TRequired, true>;
|
|
776
|
+
/**
|
|
777
|
+
* Makes this argument required.
|
|
778
|
+
* @returns this
|
|
779
|
+
*/
|
|
780
|
+
required(): Positional<TKind, true, TList>;
|
|
781
|
+
/**
|
|
782
|
+
* Makes this argument optional.
|
|
783
|
+
* @returns this
|
|
784
|
+
*/
|
|
785
|
+
optional(): Positional<TKind, false, TList>;
|
|
786
|
+
/**
|
|
787
|
+
* Sets a default value.
|
|
788
|
+
* @param value The default value.
|
|
789
|
+
* @returns this
|
|
790
|
+
*/
|
|
791
|
+
default(value: TypeOf<TKind>): this;
|
|
792
|
+
/**
|
|
793
|
+
* Sets a description.
|
|
794
|
+
* @param desc The description.
|
|
795
|
+
* @returns this
|
|
796
|
+
*/
|
|
797
|
+
description(desc: string): this;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Creates a new positional argument.
|
|
802
|
+
* @param kind The kind of positional argument.
|
|
803
|
+
* @returns A new positional argument.
|
|
804
|
+
*/
|
|
805
|
+
declare function positional<T extends Kind>(kind: T): Positional<T>;
|
|
806
|
+
|
|
807
|
+
export declare namespace prompt_2 {
|
|
808
|
+
export {
|
|
809
|
+
setTheme,
|
|
810
|
+
text,
|
|
811
|
+
password,
|
|
812
|
+
select,
|
|
813
|
+
multiselect,
|
|
814
|
+
search,
|
|
815
|
+
confirm_2 as confirm,
|
|
816
|
+
editor,
|
|
817
|
+
BaseOpts,
|
|
818
|
+
TextOpts,
|
|
819
|
+
PasswordOpts,
|
|
820
|
+
SelectOption,
|
|
821
|
+
SelectOpts,
|
|
822
|
+
SearchOpts,
|
|
823
|
+
ConfirmOpts,
|
|
824
|
+
EditorOpts,
|
|
825
|
+
raw
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
declare namespace raw {
|
|
830
|
+
export {
|
|
831
|
+
readLine,
|
|
832
|
+
readKey,
|
|
833
|
+
clearLines,
|
|
834
|
+
cursorUp,
|
|
835
|
+
cursorDown
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Reads a single key from stdin.
|
|
841
|
+
* @returns The key that was read.
|
|
842
|
+
*/
|
|
843
|
+
declare function readKey(): Promise<string>;
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* Reads a line from standard input.
|
|
847
|
+
* @param message The message.
|
|
848
|
+
* @param def Default value.
|
|
849
|
+
* @param opts Options for reading a line.
|
|
850
|
+
* @returns The line that was read.
|
|
851
|
+
*/
|
|
852
|
+
declare function readLine(message?: string, def?: string, opts?: {
|
|
853
|
+
masked?: boolean;
|
|
854
|
+
maskChar?: string;
|
|
855
|
+
multiline?: boolean;
|
|
856
|
+
}): Promise<string>;
|
|
857
|
+
|
|
858
|
+
declare const red: (input: any) => string;
|
|
859
|
+
|
|
860
|
+
declare const redBright: (input: any) => string;
|
|
861
|
+
|
|
862
|
+
declare const reset: (input: any) => string;
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Prompts the user to search through a list of options.
|
|
866
|
+
* @param opts Options for search input.
|
|
867
|
+
* @returns The selected option.
|
|
868
|
+
*/
|
|
869
|
+
declare function search<T>(opts: SearchOpts<T>): Promise<T>;
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
|
+
* Options for search input.
|
|
873
|
+
*/
|
|
874
|
+
declare interface SearchOpts<T> extends BaseOpts<T> {
|
|
875
|
+
/**
|
|
876
|
+
* Every option the user can search through.
|
|
877
|
+
*/
|
|
878
|
+
options: SelectOption<T>[];
|
|
879
|
+
/**
|
|
880
|
+
* Placeholder for the search input.
|
|
881
|
+
*/
|
|
882
|
+
placeholder?: string;
|
|
883
|
+
/**
|
|
884
|
+
* Minimum length for a query string.
|
|
885
|
+
*/
|
|
886
|
+
minQueryLength?: number;
|
|
887
|
+
/**
|
|
888
|
+
* Filters a single option.
|
|
889
|
+
* @param query The search query.
|
|
890
|
+
* @param option The option to filter.
|
|
891
|
+
*/
|
|
892
|
+
filter?(query: string, option: SelectOption<T>): boolean;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
/**
|
|
896
|
+
* Prompts the user to select a single option.
|
|
897
|
+
* @param opts Options for select input.
|
|
898
|
+
* @returns The selected option's value.
|
|
899
|
+
*/
|
|
900
|
+
declare function select<T>(opts: SelectOpts<T>): Promise<T>;
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* An option for select input.
|
|
904
|
+
*/
|
|
905
|
+
declare interface SelectOption<T> {
|
|
906
|
+
/**
|
|
907
|
+
* The label (what gets displayed) of the select option.
|
|
908
|
+
*/
|
|
909
|
+
label: string;
|
|
910
|
+
/**
|
|
911
|
+
* The value (what gets returned) of the select option.
|
|
912
|
+
*/
|
|
913
|
+
value: T;
|
|
914
|
+
/**
|
|
915
|
+
* A description of the option.
|
|
916
|
+
*/
|
|
917
|
+
hint?: string;
|
|
918
|
+
/**
|
|
919
|
+
* If this option is disabled.
|
|
920
|
+
*/
|
|
921
|
+
disabled?: boolean;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
/**
|
|
925
|
+
* Options for select input.
|
|
926
|
+
*/
|
|
927
|
+
declare interface SelectOpts<T> extends BaseOpts<T> {
|
|
928
|
+
/**
|
|
929
|
+
* Every option the user can pick from.
|
|
930
|
+
*/
|
|
931
|
+
options: SelectOption<T>[];
|
|
932
|
+
/**
|
|
933
|
+
* The initial option selected.
|
|
934
|
+
*/
|
|
935
|
+
initialIndex?: number;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* Sets new configuration.
|
|
940
|
+
* @param c The config.
|
|
941
|
+
*/
|
|
942
|
+
declare function setConfig(c: Partial<LogConfig>): Promise<void>;
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Sets the theme of the prompts.
|
|
946
|
+
* @param t The new theme.
|
|
947
|
+
*/
|
|
948
|
+
declare function setTheme(t: Theme_2): void;
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Sets a new theme.
|
|
952
|
+
* @param t The theme.
|
|
953
|
+
*/
|
|
954
|
+
declare function setTheme_2(t: Theme): void;
|
|
955
|
+
|
|
956
|
+
/**
|
|
957
|
+
* Sets default configuration.
|
|
958
|
+
*/
|
|
959
|
+
declare function setup(): Promise<void>;
|
|
960
|
+
|
|
961
|
+
/** The Standard Schema interface. */
|
|
962
|
+
declare interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
963
|
+
/** The Standard Schema properties. */
|
|
964
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
declare namespace StandardSchemaV1 {
|
|
968
|
+
/** The Standard Schema properties interface. */
|
|
969
|
+
interface Props<Input = unknown, Output = Input> {
|
|
970
|
+
/** The version number of the standard. */
|
|
971
|
+
readonly version: 1;
|
|
972
|
+
/** The vendor name of the schema library. */
|
|
973
|
+
readonly vendor: string;
|
|
974
|
+
/** Validates unknown input values. */
|
|
975
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
976
|
+
/** Inferred types associated with the schema. */
|
|
977
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
978
|
+
}
|
|
979
|
+
/** The result interface of the validate function. */
|
|
980
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
981
|
+
/** The result interface if validation succeeds. */
|
|
982
|
+
interface SuccessResult<Output> {
|
|
983
|
+
/** The typed output value. */
|
|
984
|
+
readonly value: Output;
|
|
985
|
+
/** The non-existent issues. */
|
|
986
|
+
readonly issues?: undefined;
|
|
987
|
+
}
|
|
988
|
+
/** The result interface if validation fails. */
|
|
989
|
+
interface FailureResult {
|
|
990
|
+
/** The issues of failed validation. */
|
|
991
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
992
|
+
}
|
|
993
|
+
/** The issue interface of the failure output. */
|
|
994
|
+
interface Issue {
|
|
995
|
+
/** The error message of the issue. */
|
|
996
|
+
readonly message: string;
|
|
997
|
+
/** The path of the issue, if any. */
|
|
998
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
999
|
+
}
|
|
1000
|
+
/** The path segment interface of the issue. */
|
|
1001
|
+
interface PathSegment {
|
|
1002
|
+
/** The key representing a path segment. */
|
|
1003
|
+
readonly key: PropertyKey;
|
|
1004
|
+
}
|
|
1005
|
+
/** The Standard Schema types interface. */
|
|
1006
|
+
interface Types<Input = unknown, Output = Input> {
|
|
1007
|
+
/** The input type of the schema. */
|
|
1008
|
+
readonly input: Input;
|
|
1009
|
+
/** The output type of the schema. */
|
|
1010
|
+
readonly output: Output;
|
|
1011
|
+
}
|
|
1012
|
+
/** Infers the input type of a Standard Schema. */
|
|
1013
|
+
type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
1014
|
+
/** Infers the output type of a Standard Schema. */
|
|
1015
|
+
type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
declare const strikethrough: (input: any) => string;
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* If the runtime supports color.
|
|
1022
|
+
*/
|
|
1023
|
+
declare const supportsColor: boolean;
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Prompts the user for text input.
|
|
1027
|
+
* @param opts Options for text input.
|
|
1028
|
+
* @returns The text the user typed in, or the default.
|
|
1029
|
+
*/
|
|
1030
|
+
declare function text(opts: TextOpts): Promise<string>;
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Options for text input.
|
|
1034
|
+
*/
|
|
1035
|
+
declare interface TextOpts extends BaseOpts<string> {
|
|
1036
|
+
/**
|
|
1037
|
+
* A placeholder, displayed when the user hasn't typed anything yet.
|
|
1038
|
+
*/
|
|
1039
|
+
placeholder?: string;
|
|
1040
|
+
/**
|
|
1041
|
+
* Minimum length of the input.
|
|
1042
|
+
*/
|
|
1043
|
+
minLength?: number;
|
|
1044
|
+
/**
|
|
1045
|
+
* Maximum length of the input.
|
|
1046
|
+
*/
|
|
1047
|
+
maxLength?: number;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* A theme.
|
|
1052
|
+
*/
|
|
1053
|
+
declare interface Theme {
|
|
1054
|
+
/**
|
|
1055
|
+
* Wraps a string in a background ANSI code.
|
|
1056
|
+
* @param a The string to wrap.
|
|
1057
|
+
*/
|
|
1058
|
+
background?(a: string): string;
|
|
1059
|
+
/**
|
|
1060
|
+
* Wraps a string in a foreground ANSI code.
|
|
1061
|
+
* @param a The string to wrap.
|
|
1062
|
+
*/
|
|
1063
|
+
foreground?(a: string): string;
|
|
1064
|
+
/**
|
|
1065
|
+
* Wraps a string in a primary ANSI code.
|
|
1066
|
+
* @param a The string to wrap.
|
|
1067
|
+
*/
|
|
1068
|
+
primary(a: string): string;
|
|
1069
|
+
/**
|
|
1070
|
+
* Wraps a string in a secondary ANSI code.
|
|
1071
|
+
* @param a The string to wrap.
|
|
1072
|
+
*/
|
|
1073
|
+
secondary(a: string): string;
|
|
1074
|
+
/**
|
|
1075
|
+
* Wraps a string in a accent ANSI code.
|
|
1076
|
+
* @param a The string to wrap.
|
|
1077
|
+
*/
|
|
1078
|
+
accent?(a: string): string;
|
|
1079
|
+
/**
|
|
1080
|
+
* Wraps a string in a success ANSI code.
|
|
1081
|
+
* @param a The string to wrap.
|
|
1082
|
+
*/
|
|
1083
|
+
success(a: string): string;
|
|
1084
|
+
/**
|
|
1085
|
+
* Wraps a string in a warning ANSI code.
|
|
1086
|
+
* @param a The string to wrap.
|
|
1087
|
+
*/
|
|
1088
|
+
warning(a: string): string;
|
|
1089
|
+
/**
|
|
1090
|
+
* Wraps a string in a error ANSI code.
|
|
1091
|
+
* @param a The string to wrap.
|
|
1092
|
+
*/
|
|
1093
|
+
error(a: string): string;
|
|
1094
|
+
/**
|
|
1095
|
+
* Wraps a string in a info ANSI code.
|
|
1096
|
+
* @param a The string to wrap.
|
|
1097
|
+
*/
|
|
1098
|
+
info?(a: string): string;
|
|
1099
|
+
/**
|
|
1100
|
+
* Set of symbols for logging.
|
|
1101
|
+
*/
|
|
1102
|
+
symbols?: {
|
|
1103
|
+
/**
|
|
1104
|
+
* Success message symbol.
|
|
1105
|
+
*/
|
|
1106
|
+
success: string;
|
|
1107
|
+
/**
|
|
1108
|
+
* Error message symbol.
|
|
1109
|
+
*/
|
|
1110
|
+
error: string;
|
|
1111
|
+
/**
|
|
1112
|
+
* Warning message symbol.
|
|
1113
|
+
*/
|
|
1114
|
+
warning: string;
|
|
1115
|
+
/**
|
|
1116
|
+
* Information message symbol.
|
|
1117
|
+
*/
|
|
1118
|
+
info?: string;
|
|
1119
|
+
};
|
|
1120
|
+
/**
|
|
1121
|
+
* Optional styles.
|
|
1122
|
+
*/
|
|
1123
|
+
styles?: {
|
|
1124
|
+
/**
|
|
1125
|
+
* Wraps a string in a bold ANSI code.
|
|
1126
|
+
* @param a The string to wrap.
|
|
1127
|
+
*/
|
|
1128
|
+
bold?(a: string): string;
|
|
1129
|
+
/**
|
|
1130
|
+
* Wraps a string in an italic ANSI code.
|
|
1131
|
+
* @param a The string to wrap.
|
|
1132
|
+
*/
|
|
1133
|
+
italic?(a: string): string;
|
|
1134
|
+
/**
|
|
1135
|
+
* Wraps a string in an underline ANSI code.
|
|
1136
|
+
* @param a The string to wrap.
|
|
1137
|
+
*/
|
|
1138
|
+
underline?(a: string): string;
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* When you pass too many arguments.
|
|
1144
|
+
*/
|
|
1145
|
+
declare class TooManyArgumentsError extends LunarCLIError {
|
|
1146
|
+
/**
|
|
1147
|
+
* Creates a new too many arguments error.
|
|
1148
|
+
* @param command The command.
|
|
1149
|
+
*/
|
|
1150
|
+
constructor(command: Command<any>);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Prints debug information.
|
|
1155
|
+
* @param msgs The messages to write.
|
|
1156
|
+
*/
|
|
1157
|
+
declare function trace(...msgs: any[]): Promise<void>;
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* Converts a Kind to a TypeScript type.
|
|
1161
|
+
*/
|
|
1162
|
+
declare type TypeOf<T extends Kind> = T extends StandardSchemaV1<any, infer Out> ? Out : T extends "boolean" ? boolean : T extends "string" ? string : T extends "number" ? number : T extends "bigint" ? bigint : never;
|
|
1163
|
+
|
|
1164
|
+
declare const underline: (input: any) => string;
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* When you pass an unknown option, when unknown options aren't allowed.
|
|
1168
|
+
*/
|
|
1169
|
+
declare class UnknownOptionError extends LunarCLIError {
|
|
1170
|
+
/**
|
|
1171
|
+
* The option key.
|
|
1172
|
+
*/
|
|
1173
|
+
key: string;
|
|
1174
|
+
/**
|
|
1175
|
+
* Creates a new unknown option error.
|
|
1176
|
+
* @param command The command.
|
|
1177
|
+
* @param key The key.
|
|
1178
|
+
*/
|
|
1179
|
+
constructor(command: Command<any>, key: string);
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Prints warnings.
|
|
1184
|
+
* @param msgs The messages to write.
|
|
1185
|
+
*/
|
|
1186
|
+
declare function warn(...msgs: any[]): Promise<void>;
|
|
1187
|
+
|
|
1188
|
+
declare const white: (input: any) => string;
|
|
1189
|
+
|
|
1190
|
+
declare const whiteBright: (input: any) => string;
|
|
1191
|
+
|
|
1192
|
+
declare const yellow: (input: any) => string;
|
|
1193
|
+
|
|
1194
|
+
declare const yellowBright: (input: any) => string;
|
|
1195
|
+
|
|
1196
|
+
export { }
|