clerc 0.25.0 → 0.26.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/dist/index.d.ts +554 -7
- package/dist/index.js +82 -7
- package/dist/index.mjs +82 -7
- package/package.json +10 -15
- package/dist/toolkit.d.ts +0 -1
- package/dist/toolkit.js +0 -1
- package/dist/toolkit.mjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,554 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
/**
|
|
2
|
+
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
|
3
|
+
|
|
4
|
+
@category Type
|
|
5
|
+
*/
|
|
6
|
+
type Primitive =
|
|
7
|
+
| null
|
|
8
|
+
| undefined
|
|
9
|
+
| string
|
|
10
|
+
| number
|
|
11
|
+
| boolean
|
|
12
|
+
| symbol
|
|
13
|
+
| bigint;
|
|
14
|
+
|
|
15
|
+
declare global {
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
17
|
+
interface SymbolConstructor {
|
|
18
|
+
readonly observable: symbol;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
24
|
+
|
|
25
|
+
This is the counterpart of `PickIndexSignature`.
|
|
26
|
+
|
|
27
|
+
Use-cases:
|
|
28
|
+
- Remove overly permissive signatures from third-party types.
|
|
29
|
+
|
|
30
|
+
This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
|
|
31
|
+
|
|
32
|
+
It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
|
|
33
|
+
|
|
34
|
+
(The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
const indexed: Record<string, unknown> = {}; // Allowed
|
|
38
|
+
|
|
39
|
+
const keyed: Record<'foo', unknown> = {}; // Error
|
|
40
|
+
// => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
type Indexed = {} extends Record<string, unknown>
|
|
47
|
+
? '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
48
|
+
: '❌ `{}` is NOT assignable to `Record<string, unknown>`';
|
|
49
|
+
// => '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
50
|
+
|
|
51
|
+
type Keyed = {} extends Record<'foo' | 'bar', unknown>
|
|
52
|
+
? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
|
|
53
|
+
: "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
|
|
54
|
+
// => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
import type {OmitIndexSignature} from 'type-fest';
|
|
61
|
+
|
|
62
|
+
type OmitIndexSignature<ObjectType> = {
|
|
63
|
+
[KeyType in keyof ObjectType // Map each key of `ObjectType`...
|
|
64
|
+
]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
|
|
65
|
+
};
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
import type {OmitIndexSignature} from 'type-fest';
|
|
72
|
+
|
|
73
|
+
type OmitIndexSignature<ObjectType> = {
|
|
74
|
+
[KeyType in keyof ObjectType
|
|
75
|
+
// Is `{}` assignable to `Record<KeyType, unknown>`?
|
|
76
|
+
as {} extends Record<KeyType, unknown>
|
|
77
|
+
? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
|
|
78
|
+
: ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
|
|
79
|
+
]: ObjectType[KeyType];
|
|
80
|
+
};
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
import type {OmitIndexSignature} from 'type-fest';
|
|
87
|
+
|
|
88
|
+
type OmitIndexSignature<ObjectType> = {
|
|
89
|
+
[KeyType in keyof ObjectType
|
|
90
|
+
as {} extends Record<KeyType, unknown>
|
|
91
|
+
? never // => Remove this `KeyType`.
|
|
92
|
+
: KeyType // => Keep this `KeyType` as it is.
|
|
93
|
+
]: ObjectType[KeyType];
|
|
94
|
+
};
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
@example
|
|
98
|
+
```
|
|
99
|
+
import type {OmitIndexSignature} from 'type-fest';
|
|
100
|
+
|
|
101
|
+
interface Example {
|
|
102
|
+
// These index signatures will be removed.
|
|
103
|
+
[x: string]: any
|
|
104
|
+
[x: number]: any
|
|
105
|
+
[x: symbol]: any
|
|
106
|
+
[x: `head-${string}`]: string
|
|
107
|
+
[x: `${string}-tail`]: string
|
|
108
|
+
[x: `head-${string}-tail`]: string
|
|
109
|
+
[x: `${bigint}`]: string
|
|
110
|
+
[x: `embedded-${number}`]: string
|
|
111
|
+
|
|
112
|
+
// These explicitly defined keys will remain.
|
|
113
|
+
foo: 'bar';
|
|
114
|
+
qux?: 'baz';
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
118
|
+
// => { foo: 'bar'; qux?: 'baz' | undefined; }
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
@see PickIndexSignature
|
|
122
|
+
@category Object
|
|
123
|
+
*/
|
|
124
|
+
type OmitIndexSignature<ObjectType> = {
|
|
125
|
+
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
|
|
126
|
+
? never
|
|
127
|
+
: KeyType]: ObjectType[KeyType];
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
|
132
|
+
|
|
133
|
+
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
|
134
|
+
|
|
135
|
+
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
|
136
|
+
|
|
137
|
+
@example
|
|
138
|
+
```
|
|
139
|
+
import type {LiteralUnion} from 'type-fest';
|
|
140
|
+
|
|
141
|
+
// Before
|
|
142
|
+
|
|
143
|
+
type Pet = 'dog' | 'cat' | string;
|
|
144
|
+
|
|
145
|
+
const pet: Pet = '';
|
|
146
|
+
// Start typing in your TypeScript-enabled IDE.
|
|
147
|
+
// You **will not** get auto-completion for `dog` and `cat` literals.
|
|
148
|
+
|
|
149
|
+
// After
|
|
150
|
+
|
|
151
|
+
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
|
152
|
+
|
|
153
|
+
const pet: Pet2 = '';
|
|
154
|
+
// You **will** get auto-completion for `dog` and `cat` literals.
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
@category Type
|
|
158
|
+
*/
|
|
159
|
+
type LiteralUnion<
|
|
160
|
+
LiteralType,
|
|
161
|
+
BaseType extends Primitive,
|
|
162
|
+
> = LiteralType | (BaseType & Record<never, never>);
|
|
163
|
+
|
|
164
|
+
type Equals<X, Y> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? true : false;
|
|
165
|
+
type Dict<T> = Record<string, T>;
|
|
166
|
+
type MaybeArray$1<T> = T | T[];
|
|
167
|
+
type CamelCase<T extends string> = T extends `${infer A}-${infer B}${infer C}` ? `${A}${Capitalize<B>}${CamelCase<C>}` : T;
|
|
168
|
+
|
|
169
|
+
declare const DOUBLE_DASH = "--";
|
|
170
|
+
type TypeFunction<ReturnType = any> = (value: any) => ReturnType;
|
|
171
|
+
type TypeFunctionArray<ReturnType> = readonly [TypeFunction<ReturnType>];
|
|
172
|
+
type FlagType<ReturnType = any> = TypeFunction<ReturnType> | TypeFunctionArray<ReturnType>;
|
|
173
|
+
type FlagSchemaBase<TF> = {
|
|
174
|
+
/**
|
|
175
|
+
Type of the flag as a function that parses the argv string and returns the parsed value.
|
|
176
|
+
|
|
177
|
+
@example
|
|
178
|
+
```
|
|
179
|
+
type: String
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
@example Wrap in an array to accept multiple values.
|
|
183
|
+
```
|
|
184
|
+
type: [Boolean]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
@example Custom function type that uses moment.js to parse string as date.
|
|
188
|
+
```
|
|
189
|
+
type: function CustomDate(value: string) {
|
|
190
|
+
return moment(value).toDate();
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
*/
|
|
194
|
+
type: TF;
|
|
195
|
+
/**
|
|
196
|
+
A single-character alias for the flag.
|
|
197
|
+
|
|
198
|
+
@example
|
|
199
|
+
```
|
|
200
|
+
alias: 's'
|
|
201
|
+
```
|
|
202
|
+
*/
|
|
203
|
+
alias?: string;
|
|
204
|
+
} & Record<PropertyKey, unknown>;
|
|
205
|
+
type FlagSchemaDefault<TF, DefaultType = any> = FlagSchemaBase<TF> & {
|
|
206
|
+
/**
|
|
207
|
+
Default value of the flag. Also accepts a function that returns the default value.
|
|
208
|
+
[Default: undefined]
|
|
209
|
+
|
|
210
|
+
@example
|
|
211
|
+
```
|
|
212
|
+
default: 'hello'
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
@example
|
|
216
|
+
```
|
|
217
|
+
default: () => [1, 2, 3]
|
|
218
|
+
```
|
|
219
|
+
*/
|
|
220
|
+
default: DefaultType | (() => DefaultType);
|
|
221
|
+
};
|
|
222
|
+
type FlagSchema<TF = FlagType> = (FlagSchemaBase<TF> | FlagSchemaDefault<TF>);
|
|
223
|
+
type FlagTypeOrSchema<ExtraOptions = Record<string, unknown>> = FlagType | (FlagSchema & ExtraOptions);
|
|
224
|
+
type Flags$1<ExtraOptions = Record<string, unknown>> = Record<string, FlagTypeOrSchema<ExtraOptions>>;
|
|
225
|
+
type InferFlagType<Flag extends FlagTypeOrSchema> = (Flag extends (TypeFunctionArray<infer T> | FlagSchema<TypeFunctionArray<infer T>>) ? (Flag extends FlagSchemaDefault<TypeFunctionArray<T>, infer D> ? T[] | D : T[]) : (Flag extends TypeFunction<infer T> | FlagSchema<TypeFunction<infer T>> ? (Flag extends FlagSchemaDefault<TypeFunction<T>, infer D> ? T | D : T | undefined) : never));
|
|
226
|
+
interface ParsedFlags<Schemas = Record<string, unknown>> {
|
|
227
|
+
flags: Schemas;
|
|
228
|
+
unknownFlags: Record<string, (string | boolean)[]>;
|
|
229
|
+
_: string[] & {
|
|
230
|
+
[DOUBLE_DASH]: string[];
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
type TypeFlag<Schemas extends Flags$1> = ParsedFlags<{
|
|
234
|
+
[flag in keyof Schemas]: InferFlagType<Schemas[flag]>;
|
|
235
|
+
}>;
|
|
236
|
+
|
|
237
|
+
type CommandType = RootType | string;
|
|
238
|
+
type FlagOptions = FlagSchema & {
|
|
239
|
+
description?: string;
|
|
240
|
+
};
|
|
241
|
+
type Flag = FlagOptions & {
|
|
242
|
+
name: string;
|
|
243
|
+
};
|
|
244
|
+
type Flags = Dict<FlagOptions>;
|
|
245
|
+
declare interface CommandCustomProperties {
|
|
246
|
+
}
|
|
247
|
+
interface CommandOptions<P extends string[] = string[], A extends MaybeArray$1<string | RootType> = MaybeArray$1<string | RootType>, F extends Flags = Flags> extends CommandCustomProperties {
|
|
248
|
+
alias?: A;
|
|
249
|
+
parameters?: P;
|
|
250
|
+
flags?: F;
|
|
251
|
+
examples?: [string, string][];
|
|
252
|
+
notes?: string[];
|
|
253
|
+
}
|
|
254
|
+
type Command<N extends string | RootType = string, O extends CommandOptions = CommandOptions> = O & {
|
|
255
|
+
name: N;
|
|
256
|
+
description: string;
|
|
257
|
+
};
|
|
258
|
+
type CommandAlias<N extends string | RootType = string, O extends CommandOptions = CommandOptions> = Command<N, O> & {
|
|
259
|
+
__isAlias?: true;
|
|
260
|
+
};
|
|
261
|
+
type CommandWithHandler<N extends string | RootType = string, O extends CommandOptions = CommandOptions> = Command<N, O> & {
|
|
262
|
+
handler?: HandlerInCommand<HandlerContext<Record<N, Command<N, O>> & Record<never, never>, N>>;
|
|
263
|
+
};
|
|
264
|
+
type StripBrackets<Parameter extends string> = (Parameter extends `<${infer ParameterName}>` | `[${infer ParameterName}]` ? (ParameterName extends `${infer SpreadName}...` ? SpreadName : ParameterName) : never);
|
|
265
|
+
type ParameterType<Parameter extends string> = (Parameter extends `<${infer _ParameterName}...>` | `[${infer _ParameterName}...]` ? string[] : Parameter extends `<${infer _ParameterName}>` ? string : Parameter extends `[${infer _ParameterName}]` ? string | undefined : never);
|
|
266
|
+
type CommandRecord = Dict<Command> & {
|
|
267
|
+
[Root]?: Command;
|
|
268
|
+
};
|
|
269
|
+
type MakeEventMap<T extends CommandRecord> = {
|
|
270
|
+
[K in keyof T]: [InspectorContext];
|
|
271
|
+
};
|
|
272
|
+
type PossibleInputKind = string | number | boolean | Dict<any>;
|
|
273
|
+
type NonNullableParameters<T extends string[] | undefined> = T extends undefined ? [] : NonNullable<T>;
|
|
274
|
+
type TransformParameters<C extends Command> = {
|
|
275
|
+
[Parameter in NonNullableParameters<C["parameters"]>[number] as CamelCase<StripBrackets<Parameter>>]: ParameterType<Parameter>;
|
|
276
|
+
};
|
|
277
|
+
type FallbackFlags<C extends Command> = Equals<NonNullableFlag<C>["flags"], {}> extends true ? Dict<any> : NonNullableFlag<C>["flags"];
|
|
278
|
+
type NonNullableFlag<C extends Command> = TypeFlag<NonNullable<C["flags"]>>;
|
|
279
|
+
type ParseFlag<C extends CommandRecord, N extends keyof C> = N extends keyof C ? OmitIndexSignature<NonNullableFlag<C[N]>["flags"]> : FallbackFlags<C[N]>["flags"];
|
|
280
|
+
type ParseRaw<C extends Command> = NonNullableFlag<C> & {
|
|
281
|
+
flags: FallbackFlags<C>;
|
|
282
|
+
parameters: string[];
|
|
283
|
+
mergedFlags: FallbackFlags<C> & NonNullableFlag<C>["unknownFlags"];
|
|
284
|
+
};
|
|
285
|
+
type ParseParameters<C extends CommandRecord = CommandRecord, N extends keyof C = keyof C> = Equals<TransformParameters<C[N]>, {}> extends true ? N extends keyof C ? TransformParameters<C[N]> : Dict<string | string[] | undefined> : TransformParameters<C[N]>;
|
|
286
|
+
interface HandlerContext<C extends CommandRecord = CommandRecord, N extends keyof C = keyof C> {
|
|
287
|
+
name?: LiteralUnion<N, string>;
|
|
288
|
+
called?: string | RootType;
|
|
289
|
+
resolved: boolean;
|
|
290
|
+
hasRootOrAlias: boolean;
|
|
291
|
+
hasRoot: boolean;
|
|
292
|
+
raw: {
|
|
293
|
+
[K in keyof ParseRaw<C[N]>]: ParseRaw<C[N]>[K];
|
|
294
|
+
};
|
|
295
|
+
parameters: {
|
|
296
|
+
[K in keyof ParseParameters<C, N>]: ParseParameters<C, N>[K];
|
|
297
|
+
};
|
|
298
|
+
unknownFlags: ParsedFlags["unknownFlags"];
|
|
299
|
+
flags: {
|
|
300
|
+
[K in keyof ParseFlag<C, N>]: ParseFlag<C, N>[K];
|
|
301
|
+
};
|
|
302
|
+
cli: Clerc<C>;
|
|
303
|
+
}
|
|
304
|
+
type Handler<C extends CommandRecord = CommandRecord, K extends keyof C = keyof C> = (ctx: HandlerContext<C, K>) => void;
|
|
305
|
+
type HandlerInCommand<C extends HandlerContext> = (ctx: {
|
|
306
|
+
[K in keyof C]: C[K];
|
|
307
|
+
}) => void;
|
|
308
|
+
type FallbackType<T, U> = {} extends T ? U : T;
|
|
309
|
+
type InspectorContext<C extends CommandRecord = CommandRecord> = HandlerContext<C> & {
|
|
310
|
+
flags: FallbackType<TypeFlag<NonNullable<C[keyof C]["flags"]>>["flags"], Dict<any>>;
|
|
311
|
+
};
|
|
312
|
+
type Inspector<C extends CommandRecord = CommandRecord> = InspectorFn<C> | InspectorObject<C>;
|
|
313
|
+
type InspectorFn<C extends CommandRecord = CommandRecord> = (ctx: InspectorContext<C>, next: () => void) => void;
|
|
314
|
+
interface InspectorObject<C extends CommandRecord = CommandRecord> {
|
|
315
|
+
enforce?: "pre" | "post";
|
|
316
|
+
fn: InspectorFn<C>;
|
|
317
|
+
}
|
|
318
|
+
interface Plugin<T extends Clerc = Clerc, U extends Clerc = Clerc> {
|
|
319
|
+
setup: (cli: T) => U;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
declare const Root: unique symbol;
|
|
323
|
+
type RootType = typeof Root;
|
|
324
|
+
declare class Clerc<C extends CommandRecord = {}> {
|
|
325
|
+
#private;
|
|
326
|
+
private constructor();
|
|
327
|
+
get _name(): string;
|
|
328
|
+
get _description(): string;
|
|
329
|
+
get _version(): string;
|
|
330
|
+
get _inspectors(): Inspector<CommandRecord>[];
|
|
331
|
+
get _commands(): C;
|
|
332
|
+
/**
|
|
333
|
+
* Create a new cli
|
|
334
|
+
* @returns
|
|
335
|
+
* @example
|
|
336
|
+
* ```ts
|
|
337
|
+
* const cli = Clerc.create()
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
static create(name?: string, description?: string, version?: string): Clerc<{}>;
|
|
341
|
+
/**
|
|
342
|
+
* Set the name of the cli
|
|
343
|
+
* @param name
|
|
344
|
+
* @returns
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* Clerc.create()
|
|
348
|
+
* .name("test")
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
name(name: string): this;
|
|
352
|
+
/**
|
|
353
|
+
* Set the description of the cli
|
|
354
|
+
* @param description
|
|
355
|
+
* @returns
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* Clerc.create()
|
|
359
|
+
* .description("test cli")
|
|
360
|
+
*/
|
|
361
|
+
description(description: string): this;
|
|
362
|
+
/**
|
|
363
|
+
* Set the version of the cli
|
|
364
|
+
* @param version
|
|
365
|
+
* @returns
|
|
366
|
+
* @example
|
|
367
|
+
* ```ts
|
|
368
|
+
* Clerc.create()
|
|
369
|
+
* .version("1.0.0")
|
|
370
|
+
*/
|
|
371
|
+
version(version: string): this;
|
|
372
|
+
/**
|
|
373
|
+
* Register a command
|
|
374
|
+
* @param name
|
|
375
|
+
* @param description
|
|
376
|
+
* @param options
|
|
377
|
+
* @returns
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* Clerc.create()
|
|
381
|
+
* .command("test", "test command", {
|
|
382
|
+
* alias: "t",
|
|
383
|
+
* flags: {
|
|
384
|
+
* foo: {
|
|
385
|
+
* alias: "f",
|
|
386
|
+
* description: "foo flag",
|
|
387
|
+
* }
|
|
388
|
+
* }
|
|
389
|
+
* })
|
|
390
|
+
* ```
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* Clerc.create()
|
|
394
|
+
* .command("", "root", {
|
|
395
|
+
* flags: {
|
|
396
|
+
* foo: {
|
|
397
|
+
* alias: "f",
|
|
398
|
+
* description: "foo flag",
|
|
399
|
+
* }
|
|
400
|
+
* }
|
|
401
|
+
* })
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
404
|
+
command<N extends string | RootType, O extends CommandOptions<[...P], A, F>, P extends string[] = string[], A extends MaybeArray$1<string | RootType> = MaybeArray$1<string | RootType>, F extends Flags = Flags>(c: CommandWithHandler<N, O & CommandOptions<[...P], A, F>>): this & Clerc<C & Record<N, Command<N, O>>>;
|
|
405
|
+
command<N extends string | RootType, O extends CommandOptions<[...P], A, F>, P extends string[] = string[], A extends MaybeArray$1<string | RootType> = MaybeArray$1<string | RootType>, F extends Flags = Flags>(name: N, description: string, options?: O & CommandOptions<[...P], A, F>): this & Clerc<C & Record<N, Command<N, O>>>;
|
|
406
|
+
/**
|
|
407
|
+
* Register a handler
|
|
408
|
+
* @param name
|
|
409
|
+
* @param handler
|
|
410
|
+
* @returns
|
|
411
|
+
* @example
|
|
412
|
+
* ```ts
|
|
413
|
+
* Clerc.create()
|
|
414
|
+
* .command("test", "test command")
|
|
415
|
+
* .on("test", (ctx) => {
|
|
416
|
+
* console.log(ctx);
|
|
417
|
+
* })
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
on<K extends LiteralUnion<keyof CM, string>, CM extends this["_commands"] = this["_commands"]>(name: K, handler: Handler<CM, K>): this;
|
|
421
|
+
/**
|
|
422
|
+
* Use a plugin
|
|
423
|
+
* @param plugin
|
|
424
|
+
* @returns
|
|
425
|
+
* @example
|
|
426
|
+
* ```ts
|
|
427
|
+
* Clerc.create()
|
|
428
|
+
* .use(plugin)
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
use<T extends Clerc, U extends Clerc>(plugin: Plugin<T, U>): this & Clerc<C & U["_commands"]> & U;
|
|
432
|
+
/**
|
|
433
|
+
* Register a inspector
|
|
434
|
+
* @param inspector
|
|
435
|
+
* @returns
|
|
436
|
+
* @example
|
|
437
|
+
* ```ts
|
|
438
|
+
* Clerc.create()
|
|
439
|
+
* .inspector((ctx, next) => {
|
|
440
|
+
* console.log(ctx);
|
|
441
|
+
* next();
|
|
442
|
+
* })
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
inspector(inspector: Inspector): this;
|
|
446
|
+
/**
|
|
447
|
+
* Parse the command line arguments
|
|
448
|
+
* @param args
|
|
449
|
+
* @returns
|
|
450
|
+
* @example
|
|
451
|
+
* ```ts
|
|
452
|
+
* Clerc.create()
|
|
453
|
+
* .parse(process.argv.slice(2)) // Optional
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
parse(argv?: string[]): this;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
type MaybeArray<T> = T | T[];
|
|
460
|
+
|
|
461
|
+
declare const definePlugin: <T extends Clerc<{}>, U extends Clerc<{}>>(p: Plugin<T, U>) => Plugin<T, U>;
|
|
462
|
+
declare const defineHandler: <C extends Clerc<{}>, K extends keyof C["_commands"]>(_cli: C, _key: K, handler: Handler<C["_commands"], K>) => Handler<C["_commands"], K>;
|
|
463
|
+
declare const defineInspector: <C extends Clerc<{}>>(_cli: C, inspector: Inspector<C["_commands"]>) => Inspector<C["_commands"]>;
|
|
464
|
+
declare const defineCommand: <N extends string | typeof Root, O extends CommandOptions<[...P], MaybeArray<string | typeof Root>, Flags>, P extends string[]>(command: Command<N, O & CommandOptions<[...P], MaybeArray<string | typeof Root>, Flags>>, handler?: HandlerInCommand<HandlerContext<Record<N, Command<N, O>> & Record<never, never>, N>> | undefined) => CommandWithHandler<N, O & CommandOptions<[...P], MaybeArray<string | typeof Root>, Flags>>;
|
|
465
|
+
|
|
466
|
+
declare class CommandExistsError extends Error {
|
|
467
|
+
commandName: string;
|
|
468
|
+
constructor(commandName: string);
|
|
469
|
+
}
|
|
470
|
+
declare class NoSuchCommandError extends Error {
|
|
471
|
+
commandName: string;
|
|
472
|
+
constructor(commandName: string);
|
|
473
|
+
}
|
|
474
|
+
declare class NoCommandGivenError extends Error {
|
|
475
|
+
constructor();
|
|
476
|
+
}
|
|
477
|
+
declare class CommandNameConflictError extends Error {
|
|
478
|
+
n1: string;
|
|
479
|
+
n2: string;
|
|
480
|
+
constructor(n1: string, n2: string);
|
|
481
|
+
}
|
|
482
|
+
declare class NameNotSetError extends Error {
|
|
483
|
+
constructor();
|
|
484
|
+
}
|
|
485
|
+
declare class DescriptionNotSetError extends Error {
|
|
486
|
+
constructor();
|
|
487
|
+
}
|
|
488
|
+
declare class VersionNotSetError extends Error {
|
|
489
|
+
constructor();
|
|
490
|
+
}
|
|
491
|
+
declare class InvalidCommandNameError extends Error {
|
|
492
|
+
commandName: string;
|
|
493
|
+
constructor(commandName: string);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
declare function resolveFlattenCommands(commands: CommandRecord): Map<string[] | typeof Root, CommandAlias<string, CommandOptions<string[], MaybeArray$1<string | typeof Root>, Flags>>>;
|
|
497
|
+
declare function resolveCommand(commands: CommandRecord, name: string | string[] | RootType): Command<string | RootType> | undefined;
|
|
498
|
+
declare function resolveSubcommandsByParent(commands: CommandRecord, parent: string | string[], depth?: number): Command<string, CommandOptions<string[], MaybeArray$1<string | typeof Root>, Flags>>[];
|
|
499
|
+
declare const resolveRootCommands: (commands: CommandRecord) => Command<string, CommandOptions<string[], MaybeArray$1<string | typeof Root>, Flags>>[];
|
|
500
|
+
declare function resolveParametersBeforeFlag(argv: string[]): string[];
|
|
501
|
+
declare const resolveArgv: () => string[];
|
|
502
|
+
declare function compose(inspectors: Inspector[]): (getCtx: () => InspectorContext) => void;
|
|
503
|
+
declare const isInvalidName: (name: CommandType) => boolean;
|
|
504
|
+
declare const withBrackets: (s: string, isOptional?: boolean) => string;
|
|
505
|
+
declare const formatCommandName: (name: string | string[] | RootType) => string;
|
|
506
|
+
|
|
507
|
+
interface CompletionsPluginOptions {
|
|
508
|
+
command?: boolean;
|
|
509
|
+
}
|
|
510
|
+
declare const completionsPlugin: (options?: CompletionsPluginOptions) => Plugin<Clerc<{}>, Clerc<{}>>;
|
|
511
|
+
|
|
512
|
+
interface HelpPluginOptions {
|
|
513
|
+
/**
|
|
514
|
+
* Whether to registr the help command.
|
|
515
|
+
* @default true
|
|
516
|
+
*/
|
|
517
|
+
command?: boolean;
|
|
518
|
+
/**
|
|
519
|
+
* Whether to show help when no command is specified.
|
|
520
|
+
* @default true
|
|
521
|
+
*/
|
|
522
|
+
showHelpWhenNoCommand?: boolean;
|
|
523
|
+
/**
|
|
524
|
+
* Global notes.
|
|
525
|
+
*/
|
|
526
|
+
notes?: string[];
|
|
527
|
+
/**
|
|
528
|
+
* Global examples.
|
|
529
|
+
*/
|
|
530
|
+
examples?: [string, string][];
|
|
531
|
+
/**
|
|
532
|
+
* Banner
|
|
533
|
+
*/
|
|
534
|
+
banner?: string;
|
|
535
|
+
/**
|
|
536
|
+
* Render type
|
|
537
|
+
*/
|
|
538
|
+
renderer?: "cliffy";
|
|
539
|
+
}
|
|
540
|
+
declare const helpPlugin: ({ command, showHelpWhenNoCommand, notes, examples, banner, renderer, }?: HelpPluginOptions) => Plugin<Clerc<{}>, Clerc<{}>>;
|
|
541
|
+
|
|
542
|
+
declare const notFoundPlugin: () => Plugin<Clerc<{}>, Clerc<{}>>;
|
|
543
|
+
|
|
544
|
+
declare const strictFlagsPlugin: () => Plugin<Clerc<{}>, Clerc<{}>>;
|
|
545
|
+
|
|
546
|
+
interface VersionPluginOptions {
|
|
547
|
+
alias?: string[];
|
|
548
|
+
command?: boolean;
|
|
549
|
+
}
|
|
550
|
+
declare const versionPlugin: ({ alias, command, }?: VersionPluginOptions) => Plugin<Clerc<{}>, Clerc<{}>>;
|
|
551
|
+
|
|
552
|
+
declare const friendlyErrorPlugin: () => Plugin<Clerc<{}>, Clerc<{}>>;
|
|
553
|
+
|
|
554
|
+
export { Clerc, Command, CommandAlias, CommandCustomProperties, CommandExistsError, CommandNameConflictError, CommandOptions, CommandRecord, CommandType, CommandWithHandler, CompletionsPluginOptions, DescriptionNotSetError, FallbackType, Flag, FlagOptions, Flags, Handler, HandlerContext, HandlerInCommand, HelpPluginOptions, Inspector, InspectorContext, InspectorFn, InspectorObject, InvalidCommandNameError, MakeEventMap, NameNotSetError, NoCommandGivenError, NoSuchCommandError, Plugin, PossibleInputKind, Root, RootType, VersionNotSetError, completionsPlugin, compose, defineCommand, defineHandler, defineInspector, definePlugin, formatCommandName, friendlyErrorPlugin, helpPlugin, isInvalidName, notFoundPlugin, resolveArgv, resolveCommand, resolveFlattenCommands, resolveParametersBeforeFlag, resolveRootCommands, resolveSubcommandsByParent, strictFlagsPlugin, versionPlugin, withBrackets };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import mu from"tty";import st from"util";import it from"os";class at{constructor(){this.listenerMap={},this.wildcardListeners=new Set}on(e,t){return e==="*"?(this.wildcardListeners.add(t),this):(this.listenerMap[e]||(this.listenerMap[e]=new Set),this.listenerMap[e].add(t),this)}emit(e,...t){return this.listenerMap[e]&&(this.wildcardListeners.forEach(D=>D(e,...t)),this.listenerMap[e].forEach(D=>D(...t))),this}off(e,t){var D,n;return e==="**"?(this.listenerMap={},this.wildcardListeners.clear(),this):e==="*"?(t?this.wildcardListeners.delete(t):this.wildcardListeners.clear(),this):(t?(D=this.listenerMap[e])==null||D.delete(t):(n=this.listenerMap[e])==null||n.clear(),this)}}const lt="known-flag",ct="unknown-flag",ht="argument",{stringify:q}=JSON,pt=/\B([A-Z])/g,mt=u=>u.replace(pt,"-$1").toLowerCase(),{hasOwnProperty:ft}=Object.prototype,Z=(u,e)=>ft.call(u,e),dt=u=>Array.isArray(u),ku=u=>typeof u=="function"?[u,!1]:dt(u)?[u[0],!0]:ku(u.type),Ft=(u,e)=>u===Boolean?e!=="false":e,Ct=(u,e)=>typeof e=="boolean"?e:u===Number&&e===""?Number.NaN:u(e),gt=/[\s.:=]/,Et=u=>{const e=`Flag name ${q(u)}`;if(u.length===0)throw new Error(`${e} cannot be empty`);if(u.length===1)throw new Error(`${e} must be longer than a character`);const t=u.match(gt);if(t)throw new Error(`${e} cannot contain ${q(t==null?void 0:t[0])}`)},Bt=u=>{const e={},t=(D,n)=>{if(Z(e,D))throw new Error(`Duplicate flags named ${q(D)}`);e[D]=n};for(const D in u){if(!Z(u,D))continue;Et(D);const n=u[D],r=[[],...ku(n),n];t(D,r);const o=mt(D);if(D!==o&&t(o,r),"alias"in n&&typeof n.alias=="string"){const{alias:l}=n,a=`Flag alias ${q(l)} for flag ${q(D)}`;if(l.length===0)throw new Error(`${a} cannot be empty`);if(l.length>1)throw new Error(`${a} must be a single character`);t(l,r)}}return e},xt=(u,e)=>{const t={};for(const D in u){if(!Z(u,D))continue;const[n,,r,o]=e[D];if(n.length===0&&"default"in o){let{default:l}=o;typeof l=="function"&&(l=l()),t[D]=l}else t[D]=r?n:n.pop()}return t},ru="--",bt=/[.:=]/,At=/^-{1,2}\w/,yt=u=>{if(!At.test(u))return;const e=!u.startsWith(ru);let t=u.slice(e?1:2),D;const n=t.match(bt);if(n){const{index:r}=n;D=t.slice(r+1),t=t.slice(0,r)}return[t,D,e]},wt=(u,{onFlag:e,onArgument:t})=>{let D;const n=(r,o)=>{if(typeof D!="function")return!0;D(r,o),D=void 0};for(let r=0;r<u.length;r+=1){const o=u[r];if(o===ru){n();const a=u.slice(r+1);t==null||t(a,[r],!0);break}const l=yt(o);if(l){if(n(),!e)continue;const[a,s,d]=l;if(d)for(let C=0;C<a.length;C+=1){n();const m=C===a.length-1;D=e(a[C],m?s:void 0,[r,C+1,m])}else D=e(a,s,[r])}else n(o,[r])&&(t==null||t([o],[r]))}n()},St=(u,e)=>{for(const[t,D,n]of e.reverse()){if(D){const r=u[t];let o=r.slice(0,D);if(n||(o+=r.slice(D+1)),o!=="-"){u[t]=o;continue}}u.splice(t,1)}},$t=(u,e=process.argv.slice(2),{ignore:t}={})=>{const D=[],n=Bt(u),r={},o=[];return o[ru]=[],wt(e,{onFlag(l,a,s){const d=Z(n,l);if(!(t!=null&&t(d?lt:ct,l,a))){if(d){const[C,m]=n[l],h=Ft(m,a),i=(c,p)=>{D.push(s),p&&D.push(p),C.push(Ct(m,c||""))};return h===void 0?i:i(h)}Z(r,l)||(r[l]=[]),r[l].push(a===void 0?!0:a),D.push(s)}},onArgument(l,a,s){t!=null&&t(ht,e[a[0]])||(o.push(...l),s?(o[ru]=l,e.splice(a[0])):D.push(a))}}),St(e,D),{flags:xt(u,n),unknownFlags:r,_:o}},fu=u=>Array.isArray(u)?u:[u],vt=u=>u.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),Ot=(u,e)=>e.length!==u.length?!1:u.every((t,D)=>t===e[D]),Lu=(u,e)=>e.length>u.length?!1:Ot(u.slice(0,e.length),e);class Iu extends Error{constructor(e){super(`Command "${e}" exists.`),this.commandName=e}}class ou extends Error{constructor(e){super(`No such command: ${e}`),this.commandName=e}}class su extends Error{constructor(){super("No command given.")}}class ju extends Error{constructor(e,t){super(`Command name ${e} conflicts with ${t}. Maybe caused by alias.`),this.n1=e,this.n2=t}}class Nu extends Error{constructor(){super("Name not set.")}}class Wu extends Error{constructor(){super("Description not set.")}}class Pu extends Error{constructor(){super("Version not set.")}}class Hu extends Error{constructor(e){super(`Bad name format: ${e}`),this.commandName=e}}function Tt(){return typeof process!="undefined"}function Rt(){return typeof Deno!="undefined"}function Gu(u,e,t){if(t.alias){const D=fu(t.alias);for(const n of D){if(n in e)throw new ju(e[n].name,t.name);u.set(typeof n=="symbol"?n:n.split(" "),{...t,__isAlias:!0})}}}function Yu(u){const e=new Map;u[w]&&(e.set(w,u[w]),Gu(e,u,u[w]));for(const t of Object.values(u))Gu(e,u,t),e.set(t.name.split(" "),t);return e}function du(u,e){if(e===w)return u[w];const t=fu(e),D=Yu(u);let n,r;return D.forEach((o,l)=>{if(l===w){n=D.get(w),r=w;return}Lu(t,l)&&(!r||r===w||l.length>r.length)&&(n=o,r=l)}),n}function zu(u,e,t=1/0){const D=e===""?[]:Array.isArray(e)?e:e.split(" ");return Object.values(u).filter(n=>{const r=n.name.split(" ");return Lu(r,D)&&r.length-D.length<=t})}const _t=u=>zu(u,"",1);function Uu(u){const e=[];for(const t of u){if(t.startsWith("-"))break;e.push(t)}return e}const Vu=()=>Tt()?process.argv.slice(2):Rt()?Deno.args:[];function qu(u){const e={pre:[],normal:[],post:[]};for(const D of u){const n=typeof D=="object"?D:{fn:D},{enforce:r,fn:o}=n;r==="post"||r==="pre"?e[r].push(o):e.normal.push(o)}const t=[...e.pre,...e.normal,...e.post];return D=>{return n(0);function n(r){const o=t[r];return o(D(),n.bind(null,r+1))}}}const Zu=u=>typeof u=="string"&&(u.startsWith(" ")||u.endsWith(" ")),Ju=(u,e)=>e?`[${u}]`:`<${u}>`,Mt="<Root>",H=u=>Array.isArray(u)?u.join(" "):typeof u=="string"?u:Mt,{stringify:G}=JSON;function Fu(u){const e=[];let t,D;for(const n of u){if(D)throw new Error(`Invalid parameter: Spread parameter ${G(D)} must be last`);const r=n[0],o=n[n.length-1];let l;if(r==="<"&&o===">"&&(l=!0,t))throw new Error(`Invalid parameter: Required parameter ${G(n)} cannot come after optional parameter ${G(t)}`);if(r==="["&&o==="]"&&(l=!1,t=n),l===void 0)throw new Error(`Invalid parameter: ${G(n)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let a=n.slice(1,-1);const s=a.slice(-3)==="...";s&&(D=n,a=a.slice(0,-3)),e.push({name:a,required:l,spread:s})}return e}function Cu(u,e,t){for(let D=0;D<e.length;D+=1){const{name:n,required:r,spread:o}=e[D],l=vt(n);if(l in u)return new Error(`Invalid parameter: ${G(n)} is used more than once.`);const a=o?t.slice(D):t[D];if(o&&(D=e.length),r&&(!a||o&&a.length===0))return new Error(`Error: Missing required parameter ${G(n)}`);u[l]=a}}var Ku=(u,e,t)=>{if(!e.has(u))throw TypeError("Cannot "+t)},y=(u,e,t)=>(Ku(u,e,"read from private field"),t?t.call(u):e.get(u)),_=(u,e,t)=>{if(e.has(u))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(u):e.set(u,t)},Y=(u,e,t,D)=>(Ku(u,e,"write to private field"),D?D.call(u,t):e.set(u,t),t),j,N,W,J,K,iu,z,gu,Qu,Eu,Xu;const w=Symbol("Root"),ue=class{constructor(u,e,t){_(this,gu),_(this,Eu),_(this,j,""),_(this,N,""),_(this,W,""),_(this,J,[]),_(this,K,{}),_(this,iu,new at),_(this,z,new Set),Y(this,j,u||y(this,j)),Y(this,N,e||y(this,N)),Y(this,W,t||y(this,W))}get _name(){return y(this,j)}get _description(){return y(this,N)}get _version(){return y(this,W)}get _inspectors(){return y(this,J)}get _commands(){return y(this,K)}static create(u,e,t){return new ue(u,e,t)}name(u){return Y(this,j,u),this}description(u){return Y(this,N,u),this}version(u){return Y(this,W,u),this}command(u,e,t={}){const D=(s=>!(typeof s=="string"||s===w))(u),n=D?u.name:u;if(Zu(n))throw new Hu(n);const{handler:r=void 0,...o}=D?u:{name:n,description:e,...t},l=[o.name],a=o.alias?fu(o.alias):[];o.alias&&l.push(...a);for(const s of l)if(y(this,z).has(s))throw new Iu(H(s));return y(this,K)[n]=o,y(this,z).add(o.name),a.forEach(s=>y(this,z).add(s)),D&&r&&this.on(u.name,r),this}on(u,e){return y(this,iu).on(u,e),this}use(u){return u.setup(this)}inspector(u){return y(this,J).push(u),this}parse(u=Vu()){if(!y(this,j))throw new Nu;if(!y(this,N))throw new Wu;if(!y(this,W))throw new Pu;const e=Uu(u),t=e.join(" "),D=()=>du(y(this,K),e),n=[],r=()=>{n.length=0;const a=D(),s=!!a,d=$t((a==null?void 0:a.flags)||{},[...u]),{_:C,flags:m,unknownFlags:h}=d;let i=!s||a.name===w?C:C.slice(a.name.split(" ").length),c=(a==null?void 0:a.parameters)||[];const p=c.indexOf("--"),F=c.slice(p+1)||[],f=Object.create(null);if(p>-1&&F.length>0){c=c.slice(0,p);const g=C["--"];i=i.slice(0,-g.length||void 0),n.push(Cu(f,Fu(c),i)),n.push(Cu(f,Fu(F),g))}else n.push(Cu(f,Fu(c),i));const E={...m,...h};return{name:a==null?void 0:a.name,called:e.length===0&&(a==null?void 0:a.name)?w:t,resolved:s,hasRootOrAlias:y(this,gu,Qu),hasRoot:y(this,Eu,Xu),raw:{...d,parameters:i,mergedFlags:E},parameters:f,flags:m,unknownFlags:h,cli:this}},o={enforce:"post",fn:()=>{const a=D(),s=r(),d=n.filter(Boolean);if(d.length>0)throw d[0];if(!a)throw t?new ou(t):new su;y(this,iu).emit(a.name,s)}},l=[...y(this,J),o];return qu(l)(r),this}};let kt=ue;j=new WeakMap,N=new WeakMap,W=new WeakMap,J=new WeakMap,K=new WeakMap,iu=new WeakMap,z=new WeakMap,gu=new WeakSet,Qu=function(){return y(this,z).has(w)},Eu=new WeakSet,Xu=function(){return Object.prototype.hasOwnProperty.call(this._commands,w)};const P=u=>u,Lt=(u,e,t)=>t,It=(u,e)=>e,jt=(u,e)=>({...u,handler:e}),Nt=u=>`
|
|
2
|
+
${u})
|
|
3
|
+
cmd+="__${u}"
|
|
4
|
+
;;`,Wt=u=>{const{cli:e}=u,{_name:t,_commands:D}=e;return`_${t}() {
|
|
5
|
+
local i cur prev opts cmds
|
|
6
|
+
COMPREPLY=()
|
|
7
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
8
|
+
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
9
|
+
cmd=""
|
|
10
|
+
opts=""
|
|
11
|
+
|
|
12
|
+
for i in \${COMP_WORDS[@]}
|
|
13
|
+
do
|
|
14
|
+
case "\${i}" in
|
|
15
|
+
"$1")
|
|
16
|
+
cmd="${t}"
|
|
17
|
+
;;
|
|
18
|
+
${Object.keys(D).map(Nt).join("")}
|
|
19
|
+
*)
|
|
20
|
+
;;
|
|
21
|
+
esac
|
|
22
|
+
done
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
complete -F _${t} -o bashdefault -o default ${t}
|
|
26
|
+
`},ee=u=>u.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`),te=u=>u.length<=1?`-${u}`:`--${ee(u)}`,De="(No Description)",Pt=u=>`[CompletionResult]::new('${u.name}', '${u.name}', [CompletionResultType]::ParameterValue, '${u.description}')`,Ht=u=>Object.entries(u.flags||{}).map(([e,t])=>{const D=[`[CompletionResult]::new('${te(e)}', '${ee(e)}', [CompletionResultType]::ParameterName, '${u.flags[e].description||De}')`];return t!=null&&t.alias&&D.push(`[CompletionResult]::new('${te(t.alias)}', '${t.alias}', [CompletionResultType]::ParameterName, '${u.flags[e].description||De}')`),D.join(`
|
|
27
|
+
`)}).join(`
|
|
28
|
+
`),Gt=u=>{const{cli:e}=u,{_name:t,_commands:D}=e;return`using namespace System.Management.Automation
|
|
29
|
+
using namespace System.Management.Automation.Language
|
|
30
|
+
|
|
31
|
+
Register-ArgumentCompleter -Native -CommandName '${t}' -ScriptBlock {
|
|
32
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
33
|
+
|
|
34
|
+
$commandElements = $commandAst.CommandElements
|
|
35
|
+
$command = @(
|
|
36
|
+
'${t}'
|
|
37
|
+
for ($i = 1; $i -lt $commandElements.Count; $i++) {
|
|
38
|
+
$element = $commandElements[$i]
|
|
39
|
+
if ($element -isnot [StringConstantExpressionAst] -or
|
|
40
|
+
$element.StringConstantType -ne [StringConstantType]::BareWord -or
|
|
41
|
+
$element.Value.StartsWith('-') -or
|
|
42
|
+
$element.Value -eq $wordToComplete) {
|
|
43
|
+
break
|
|
44
|
+
}
|
|
45
|
+
$element.Value
|
|
46
|
+
}) -join ';'
|
|
47
|
+
|
|
48
|
+
$completions = @(switch ($command) {
|
|
49
|
+
'${t}' {
|
|
50
|
+
${Object.entries(D).map(([n,r])=>Pt(r)).join(`
|
|
51
|
+
`)}
|
|
52
|
+
break
|
|
53
|
+
}
|
|
54
|
+
${Object.entries(D).map(([n,r])=>`'${t};${n.split(" ").join(";")}' {
|
|
55
|
+
${Ht(r)}
|
|
56
|
+
break
|
|
57
|
+
}`).join(`
|
|
58
|
+
`)}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
|
|
62
|
+
Sort-Object -Property ListItemText
|
|
63
|
+
}`},ne={bash:Wt,pwsh:Gt},Yt=(u={})=>P({setup:e=>{const{command:t=!0}=u;return t&&(e=e.command("completions","Print shell completions to stdout",{flags:{shell:{description:"Shell type",type:String,default:""}},parameters:["[shell]"]}).on("completions",D=>{if(!e._name)throw new Error("CLI name is not defined!");const n=String(D.parameters.shell||D.flags.shell);if(!n)throw new Error("Missing shell name");if(n in ne)process.stdout.write(ne[n](D));else throw new Error(`No such shell: ${n}`)})),e}}),zt=u=>Array.isArray(u)?u:[u],Ut=u=>u.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`),re=u=>u.length<=1?`-${u}`:`--${Ut(u)}`;function Vt(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var $={exports:{}};let qt=mu,Zt=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||qt.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),B=(u,e,t=u)=>D=>{let n=""+D,r=n.indexOf(e,u.length);return~r?u+oe(n,e,t,r)+e:u+n+e},oe=(u,e,t,D)=>{let n=u.substring(0,D)+t,r=u.substring(D+e.length),o=r.indexOf(e);return~o?n+oe(r,e,t,o):n+r},se=(u=Zt)=>({isColorSupported:u,reset:u?e=>`\x1B[0m${e}\x1B[0m`:String,bold:u?B("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?B("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?B("\x1B[3m","\x1B[23m"):String,underline:u?B("\x1B[4m","\x1B[24m"):String,inverse:u?B("\x1B[7m","\x1B[27m"):String,hidden:u?B("\x1B[8m","\x1B[28m"):String,strikethrough:u?B("\x1B[9m","\x1B[29m"):String,black:u?B("\x1B[30m","\x1B[39m"):String,red:u?B("\x1B[31m","\x1B[39m"):String,green:u?B("\x1B[32m","\x1B[39m"):String,yellow:u?B("\x1B[33m","\x1B[39m"):String,blue:u?B("\x1B[34m","\x1B[39m"):String,magenta:u?B("\x1B[35m","\x1B[39m"):String,cyan:u?B("\x1B[36m","\x1B[39m"):String,white:u?B("\x1B[37m","\x1B[39m"):String,gray:u?B("\x1B[90m","\x1B[39m"):String,bgBlack:u?B("\x1B[40m","\x1B[49m"):String,bgRed:u?B("\x1B[41m","\x1B[49m"):String,bgGreen:u?B("\x1B[42m","\x1B[49m"):String,bgYellow:u?B("\x1B[43m","\x1B[49m"):String,bgBlue:u?B("\x1B[44m","\x1B[49m"):String,bgMagenta:u?B("\x1B[45m","\x1B[49m"):String,bgCyan:u?B("\x1B[46m","\x1B[49m"):String,bgWhite:u?B("\x1B[47m","\x1B[49m"):String});$.exports=se(),$.exports.createColors=se;var Jt=Function.prototype.toString,Kt=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;function Qt(u){if(typeof u!="function")return null;var e="";if(typeof Function.prototype.name=="undefined"&&typeof u.name=="undefined"){var t=Jt.call(u).match(Kt);t&&(e=t[1])}else e=u.name;return e}var ie=Qt,ae={exports:{}};let Bu=[],le=0;const S=(u,e)=>{le>=e&&Bu.push(u)};S.WARN=1,S.INFO=2,S.DEBUG=3,S.reset=()=>{Bu=[]},S.setDebugLevel=u=>{le=u},S.warn=u=>S(u,S.WARN),S.info=u=>S(u,S.INFO),S.debug=u=>S(u,S.DEBUG),S.debugMessages=()=>Bu;var xu=S,bu={exports:{}},Xt=({onlyFirst:u=!1}={})=>{const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,u?void 0:"g")};const uD=Xt;var eD=u=>typeof u=="string"?u.replace(uD(),""):u,Au={exports:{}};const ce=u=>Number.isNaN(u)?!1:u>=4352&&(u<=4447||u===9001||u===9002||11904<=u&&u<=12871&&u!==12351||12880<=u&&u<=19903||19968<=u&&u<=42182||43360<=u&&u<=43388||44032<=u&&u<=55203||63744<=u&&u<=64255||65040<=u&&u<=65049||65072<=u&&u<=65131||65281<=u&&u<=65376||65504<=u&&u<=65510||110592<=u&&u<=110593||127488<=u&&u<=127569||131072<=u&&u<=262141);Au.exports=ce,Au.exports.default=ce;var tD=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};const DD=eD,nD=Au.exports,rD=tD,he=u=>{if(typeof u!="string"||u.length===0||(u=DD(u),u.length===0))return 0;u=u.replace(rD()," ");let e=0;for(let t=0;t<u.length;t++){const D=u.codePointAt(t);D<=31||D>=127&&D<=159||D>=768&&D<=879||(D>65535&&t++,e+=nD(D)?2:1)}return e};bu.exports=he,bu.exports.default=he;const pe=bu.exports;function au(u){return u?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function R(u){let e=au();return(""+u).replace(e,"").split(`
|
|
64
|
+
`).reduce(function(t,D){return pe(D)>t?pe(D):t},0)}function Q(u,e){return Array(e+1).join(u)}function oD(u,e,t,D){let n=R(u);if(e+1>=n){let r=e-n;switch(D){case"right":{u=Q(t,r)+u;break}case"center":{let o=Math.ceil(r/2),l=r-o;u=Q(t,l)+u+Q(t,o);break}default:{u=u+Q(t,r);break}}}return u}let U={};function X(u,e,t){e="\x1B["+e+"m",t="\x1B["+t+"m",U[e]={set:u,to:!0},U[t]={set:u,to:!1},U[u]={on:e,off:t}}X("bold",1,22),X("italics",3,23),X("underline",4,24),X("inverse",7,27),X("strikethrough",9,29);function me(u,e){let t=e[1]?parseInt(e[1].split(";")[0]):0;if(t>=30&&t<=39||t>=90&&t<=97){u.lastForegroundAdded=e[0];return}if(t>=40&&t<=49||t>=100&&t<=107){u.lastBackgroundAdded=e[0];return}if(t===0){for(let n in u)Object.prototype.hasOwnProperty.call(u,n)&&delete u[n];return}let D=U[e[0]];D&&(u[D.set]=D.to)}function sD(u){let e=au(!0),t=e.exec(u),D={};for(;t!==null;)me(D,t),t=e.exec(u);return D}function fe(u,e){let t=u.lastBackgroundAdded,D=u.lastForegroundAdded;return delete u.lastBackgroundAdded,delete u.lastForegroundAdded,Object.keys(u).forEach(function(n){u[n]&&(e+=U[n].off)}),t&&t!="\x1B[49m"&&(e+="\x1B[49m"),D&&D!="\x1B[39m"&&(e+="\x1B[39m"),e}function iD(u,e){let t=u.lastBackgroundAdded,D=u.lastForegroundAdded;return delete u.lastBackgroundAdded,delete u.lastForegroundAdded,Object.keys(u).forEach(function(n){u[n]&&(e=U[n].on+e)}),t&&t!="\x1B[49m"&&(e=t+e),D&&D!="\x1B[39m"&&(e=D+e),e}function aD(u,e){if(u.length===R(u))return u.substr(0,e);for(;R(u)>e;)u=u.slice(0,-1);return u}function lD(u,e){let t=au(!0),D=u.split(au()),n=0,r=0,o="",l,a={};for(;r<e;){l=t.exec(u);let s=D[n];if(n++,r+R(s)>e&&(s=aD(s,e-r)),o+=s,r+=R(s),r<e){if(!l)break;o+=l[0],me(a,l)}}return fe(a,o)}function cD(u,e,t){return t=t||"\u2026",R(u)<=e?u:(e-=R(t),lD(u,e)+t)}function hD(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function pD(u,e){u=u||{},e=e||hD();let t=Object.assign({},e,u);return t.chars=Object.assign({},e.chars,u.chars),t.style=Object.assign({},e.style,u.style),t}function mD(u,e){let t=[],D=e.split(/(\s+)/g),n=[],r=0,o;for(let l=0;l<D.length;l+=2){let a=D[l],s=r+R(a);r>0&&o&&(s+=o.length),s>u?(r!==0&&t.push(n.join("")),n=[a],r=R(a)):(n.push(o||"",a),r=s),o=D[l+1]}return r&&t.push(n.join("")),t}function fD(u,e){let t=[],D="";function n(o,l){for(D.length&&l&&(D+=l),D+=o;D.length>u;)t.push(D.slice(0,u)),D=D.slice(u)}let r=e.split(/(\s+)/g);for(let o=0;o<r.length;o+=2)n(r[o],o&&r[o-1]);return D.length&&t.push(D),t}function dD(u,e,t=!0){let D=[];e=e.split(`
|
|
65
|
+
`);const n=t?mD:fD;for(let r=0;r<e.length;r++)D.push.apply(D,n(u,e[r]));return D}function FD(u){let e={},t=[];for(let D=0;D<u.length;D++){let n=iD(e,u[D]);e=sD(n);let r=Object.assign({},e);t.push(fe(r,n))}return t}function CD(u,e){const t="\x1B]",D="\x07",n=";";return[t,"8",n,n,u||e,D,e,t,"8",n,n,D].join("")}var de={strlen:R,repeat:Q,pad:oD,truncate:cD,mergeOptions:pD,wordWrap:dD,colorizeLines:FD,hyperlink:CD},Fe={exports:{}},lu={exports:{}},Ce={exports:{}},ge={exports:{}},Ee={exports:{}},Be;function gD(){return Be||(Be=1,function(u){var e={};u.exports=e;var t={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(t).forEach(function(D){var n=t[D],r=e[D]=[];r.open="\x1B["+n[0]+"m",r.close="\x1B["+n[1]+"m"})}(Ee)),Ee.exports}var xe,be;function ED(){return be||(be=1,xe=function(u,e){e=e||process.argv;var t=e.indexOf("--"),D=/^-{1,2}/.test(u)?"":"--",n=e.indexOf(D+u);return n!==-1&&(t===-1?!0:n<t)}),xe}var yu,Ae;function BD(){if(Ae)return yu;Ae=1;var u=it,e=ED(),t=process.env,D=void 0;e("no-color")||e("no-colors")||e("color=false")?D=!1:(e("color")||e("colors")||e("color=true")||e("color=always"))&&(D=!0),"FORCE_COLOR"in t&&(D=t.FORCE_COLOR.length===0||parseInt(t.FORCE_COLOR,10)!==0);function n(l){return l===0?!1:{level:l,hasBasic:!0,has256:l>=2,has16m:l>=3}}function r(l){if(D===!1)return 0;if(e("color=16m")||e("color=full")||e("color=truecolor"))return 3;if(e("color=256"))return 2;if(l&&!l.isTTY&&D!==!0)return 0;var a=D?1:0;if(process.platform==="win32"){var s=u.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in t)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(C){return C in t})||t.CI_NAME==="codeship"?1:a;if("TEAMCITY_VERSION"in t)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(t.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in t){var d=parseInt((t.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(t.TERM_PROGRAM){case"iTerm.app":return d>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(t.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(t.TERM)||"COLORTERM"in t?1:(t.TERM,a)}function o(l){var a=r(l);return n(a)}return yu={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)},yu}var ye={exports:{}},we;function xD(){return we||(we=1,function(u){u.exports=function(e,t){var D="";e=e||"Run the trap, drop the bass",e=e.split("");var n={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(r){r=r.toLowerCase();var o=n[r]||[" "],l=Math.floor(Math.random()*o.length);typeof n[r]!="undefined"?D+=n[r][l]:D+=r}),D}}(ye)),ye.exports}var Se={exports:{}},$e;function bD(){return $e||($e=1,function(u){u.exports=function(e,t){e=e||" he is here ";var D={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},n=[].concat(D.up,D.down,D.mid);function r(a){var s=Math.floor(Math.random()*a);return s}function o(a){var s=!1;return n.filter(function(d){s=d===a}),s}function l(a,s){var d="",C,m;s=s||{},s.up=typeof s.up!="undefined"?s.up:!0,s.mid=typeof s.mid!="undefined"?s.mid:!0,s.down=typeof s.down!="undefined"?s.down:!0,s.size=typeof s.size!="undefined"?s.size:"maxi",a=a.split("");for(m in a)if(!o(m)){switch(d=d+a[m],C={up:0,down:0,mid:0},s.size){case"mini":C.up=r(8),C.mid=r(2),C.down=r(8);break;case"maxi":C.up=r(16)+3,C.mid=r(4)+1,C.down=r(64)+3;break;default:C.up=r(8)+1,C.mid=r(6)/2,C.down=r(8)+1;break}var h=["up","mid","down"];for(var i in h)for(var c=h[i],p=0;p<=C[c];p++)s[c]&&(d=d+D[c][r(D[c].length)])}return d}return l(e,t)}}(Se)),Se.exports}var ve={exports:{}},Oe;function AD(){return Oe||(Oe=1,function(u){u.exports=function(e){return function(t,D,n){if(t===" ")return t;switch(D%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}}(ve)),ve.exports}var Te={exports:{}},Re;function yD(){return Re||(Re=1,function(u){u.exports=function(e){return function(t,D,n){return D%2===0?t:e.inverse(t)}}}(Te)),Te.exports}var _e={exports:{}},Me;function wD(){return Me||(Me=1,function(u){u.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(D,n,r){return D===" "?D:e[t[n++%t.length]](D)}}}(_e)),_e.exports}var ke={exports:{}},Le;function SD(){return Le||(Le=1,function(u){u.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(D,n,r){return D===" "?D:e[t[Math.round(Math.random()*(t.length-2))]](D)}}}(ke)),ke.exports}var Ie;function $D(){return Ie||(Ie=1,function(u){var e={};u.exports=e,e.themes={};var t=st,D=e.styles=gD(),n=Object.defineProperties,r=new RegExp(/[\r\n]+/g);e.supportsColor=BD().supportsColor,typeof e.enabled=="undefined"&&(e.enabled=e.supportsColor()!==!1),e.enable=function(){e.enabled=!0},e.disable=function(){e.enabled=!1},e.stripColors=e.strip=function(c){return(""+c).replace(/\x1B\[\d+m/g,"")},e.stylize=function(c,p){if(!e.enabled)return c+"";var F=D[p];return!F&&p in e?e[p](c):F.open+c+F.close};var o=/[|\\{}()[\]^$+*?.]/g,l=function(c){if(typeof c!="string")throw new TypeError("Expected a string");return c.replace(o,"\\$&")};function a(c){var p=function F(){return C.apply(F,arguments)};return p._styles=c,p.__proto__=d,p}var s=function(){var c={};return D.grey=D.gray,Object.keys(D).forEach(function(p){D[p].closeRe=new RegExp(l(D[p].close),"g"),c[p]={get:function(){return a(this._styles.concat(p))}}}),c}(),d=n(function(){},s);function C(){var c=Array.prototype.slice.call(arguments),p=c.map(function(A){return A!=null&&A.constructor===String?A:t.inspect(A)}).join(" ");if(!e.enabled||!p)return p;for(var F=p.indexOf(`
|
|
66
|
+
`)!=-1,f=this._styles,E=f.length;E--;){var g=D[f[E]];p=g.open+p.replace(g.closeRe,g.open)+g.close,F&&(p=p.replace(r,function(A){return g.close+A+g.open}))}return p}e.setTheme=function(c){if(typeof c=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var p in c)(function(F){e[F]=function(f){if(typeof c[F]=="object"){var E=f;for(var g in c[F])E=e[c[F][g]](E);return E}return e[c[F]](f)}})(p)};function m(){var c={};return Object.keys(s).forEach(function(p){c[p]={get:function(){return a([p])}}}),c}var h=function(c,p){var F=p.split("");return F=F.map(c),F.join("")};e.trap=xD(),e.zalgo=bD(),e.maps={},e.maps.america=AD()(e),e.maps.zebra=yD()(e),e.maps.rainbow=wD()(e),e.maps.random=SD()(e);for(var i in e.maps)(function(c){e[c]=function(p){return h(e.maps[c],p)}})(i);n(e,m())}(ge)),ge.exports}var je;function vD(){return je||(je=1,function(u){var e=$D();u.exports=e}(Ce)),Ce.exports}const{info:OD,debug:Ne}=xu,v=de;class eu{constructor(e){this.setOptions(e),this.x=null,this.y=null}setOptions(e){["boolean","number","string"].indexOf(typeof e)!==-1&&(e={content:""+e}),e=e||{},this.options=e;let t=e.content;if(["boolean","number","string"].indexOf(typeof t)!==-1)this.content=String(t);else if(!t)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof t);this.colSpan=e.colSpan||1,this.rowSpan=e.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(e,t){this.cells=t;let D=this.options.chars||{},n=e.chars,r=this.chars={};RD.forEach(function(a){$u(D,n,a,r)}),this.truncate=this.options.truncate||e.truncate;let o=this.options.style=this.options.style||{},l=e.style;$u(o,l,"padding-left",this),$u(o,l,"padding-right",this),this.head=o.head||l.head,this.border=o.border||l.border,this.fixedWidth=e.colWidths[this.x],this.lines=this.computeLines(e),this.desiredWidth=v.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(e){const t=e.wordWrap||e.textWrap,{wordWrap:D=t}=this.options;if(this.fixedWidth&&D){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let o=1;for(;o<this.colSpan;)this.fixedWidth+=e.colWidths[this.x+o],o++}const{wrapOnWordBoundary:n=!0}=e,{wrapOnWordBoundary:r=n}=this.options;return this.wrapLines(v.wordWrap(this.fixedWidth,this.content,r))}return this.wrapLines(this.content.split(`
|
|
67
|
+
`))}wrapLines(e){const t=v.colorizeLines(e);return this.href?t.map(D=>v.hyperlink(this.href,D)):t}init(e){let t=this.x,D=this.y;this.widths=e.colWidths.slice(t,t+this.colSpan),this.heights=e.rowHeights.slice(D,D+this.rowSpan),this.width=this.widths.reduce(Pe,-1),this.height=this.heights.reduce(Pe,-1),this.hAlign=this.options.hAlign||e.colAligns[t],this.vAlign=this.options.vAlign||e.rowAligns[D],this.drawRight=t+this.colSpan==e.colWidths.length}draw(e,t){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let D=v.truncate(this.content,10,this.truncate);e||OD(`${this.y}-${this.x}: ${this.rowSpan-e}x${this.colSpan} Cell ${D}`);let n=Math.max(this.height-this.lines.length,0),r;switch(this.vAlign){case"center":r=Math.ceil(n/2);break;case"bottom":r=n;break;default:r=0}if(e<r||e>=r+this.lines.length)return this.drawEmpty(this.drawRight,t);let o=this.lines.length>this.height&&e+1>=this.height;return this.drawLine(e-r,this.drawRight,o,t)}drawTop(e){let t=[];return this.cells?this.widths.forEach(function(D,n){t.push(this._topLeftChar(n)),t.push(v.repeat(this.chars[this.y==0?"top":"mid"],D))},this):(t.push(this._topLeftChar(0)),t.push(v.repeat(this.chars[this.y==0?"top":"mid"],this.width))),e&&t.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",t.join(""))}_topLeftChar(e){let t=this.x+e,D;if(this.y==0)D=t==0?"topLeft":e==0?"topMid":"top";else if(t==0)D="leftMid";else if(D=e==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][t]instanceof eu.ColSpanCell&&(D=e==0?"topMid":"mid"),e==0)){let n=1;for(;this.cells[this.y][t-n]instanceof eu.ColSpanCell;)n++;this.cells[this.y][t-n]instanceof eu.RowSpanCell&&(D="leftMid")}return this.chars[D]}wrapWithStyleColors(e,t){if(this[e]&&this[e].length)try{let D=vD();for(let n=this[e].length-1;n>=0;n--)D=D[this[e][n]];return D(t)}catch(D){return t}else return t}drawLine(e,t,D,n){let r=this.chars[this.x==0?"left":"middle"];if(this.x&&n&&this.cells){let m=this.cells[this.y+n][this.x-1];for(;m instanceof wu;)m=this.cells[m.y][m.x-1];m instanceof Su||(r=this.chars.rightMid)}let o=v.repeat(" ",this.paddingLeft),l=t?this.chars.right:"",a=v.repeat(" ",this.paddingRight),s=this.lines[e],d=this.width-(this.paddingLeft+this.paddingRight);D&&(s+=this.truncate||"\u2026");let C=v.truncate(s,d,this.truncate);return C=v.pad(C,d," ",this.hAlign),C=o+C+a,this.stylizeLine(r,C,l)}stylizeLine(e,t,D){return e=this.wrapWithStyleColors("border",e),D=this.wrapWithStyleColors("border",D),this.y===0&&(t=this.wrapWithStyleColors("head",t)),e+t+D}drawBottom(e){let t=this.chars[this.x==0?"bottomLeft":"bottomMid"],D=v.repeat(this.chars.bottom,this.width),n=e?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",t+D+n)}drawEmpty(e,t){let D=this.chars[this.x==0?"left":"middle"];if(this.x&&t&&this.cells){let o=this.cells[this.y+t][this.x-1];for(;o instanceof wu;)o=this.cells[o.y][o.x-1];o instanceof Su||(D=this.chars.rightMid)}let n=e?this.chars.right:"",r=v.repeat(" ",this.width);return this.stylizeLine(D,r,n)}}class wu{constructor(){}draw(e){return typeof e=="number"&&Ne(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}}class Su{constructor(e){this.originalCell=e}init(e){let t=this.y,D=this.originalCell.y;this.cellOffset=t-D,this.offset=TD(e.rowHeights,D,this.cellOffset)}draw(e){return e=="top"?this.originalCell.draw(this.offset,this.cellOffset):e=="bottom"?this.originalCell.draw("bottom"):(Ne(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+e))}mergeTableOptions(){}}function We(...u){return u.filter(e=>e!=null).shift()}function $u(u,e,t,D){let n=t.split("-");n.length>1?(n[1]=n[1].charAt(0).toUpperCase()+n[1].substr(1),n=n.join(""),D[n]=We(u[n],u[t],e[n],e[t])):D[t]=We(u[t],e[t])}function TD(u,e,t){let D=u[e];for(let n=1;n<t;n++)D+=1+u[e+n];return D}function Pe(u,e){return u+e+1}let RD=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];lu.exports=eu,lu.exports.ColSpanCell=wu,lu.exports.RowSpanCell=Su;const{warn:_D,debug:MD}=xu,vu=lu.exports,{ColSpanCell:kD,RowSpanCell:LD}=vu;(function(){function u(h,i){return h[i]>0?u(h,i+1):i}function e(h){let i={};h.forEach(function(c,p){let F=0;c.forEach(function(f){f.y=p,f.x=p?u(i,F):F;const E=f.rowSpan||1,g=f.colSpan||1;if(E>1)for(let A=0;A<g;A++)i[f.x+A]=E;F=f.x+g}),Object.keys(i).forEach(f=>{i[f]--,i[f]<1&&delete i[f]})})}function t(h){let i=0;return h.forEach(function(c){c.forEach(function(p){i=Math.max(i,p.x+(p.colSpan||1))})}),i}function D(h){return h.length}function n(h,i){let c=h.y,p=h.y-1+(h.rowSpan||1),F=i.y,f=i.y-1+(i.rowSpan||1),E=!(c>f||F>p),g=h.x,A=h.x-1+(h.colSpan||1),tu=i.x,Du=i.x-1+(i.colSpan||1),I=!(g>Du||tu>A);return E&&I}function r(h,i,c){let p=Math.min(h.length-1,c),F={x:i,y:c};for(let f=0;f<=p;f++){let E=h[f];for(let g=0;g<E.length;g++)if(n(F,E[g]))return!0}return!1}function o(h,i,c,p){for(let F=c;F<p;F++)if(r(h,F,i))return!1;return!0}function l(h){h.forEach(function(i,c){i.forEach(function(p){for(let F=1;F<p.rowSpan;F++){let f=new LD(p);f.x=p.x,f.y=p.y+F,f.colSpan=p.colSpan,s(f,h[c+F])}})})}function a(h){for(let i=h.length-1;i>=0;i--){let c=h[i];for(let p=0;p<c.length;p++){let F=c[p];for(let f=1;f<F.colSpan;f++){let E=new kD;E.x=F.x+f,E.y=F.y,c.splice(p+1,0,E)}}}}function s(h,i){let c=0;for(;c<i.length&&i[c].x<h.x;)c++;i.splice(c,0,h)}function d(h){let i=D(h),c=t(h);MD(`Max rows: ${i}; Max cols: ${c}`);for(let p=0;p<i;p++)for(let F=0;F<c;F++)if(!r(h,F,p)){let f={x:F,y:p,colSpan:1,rowSpan:1};for(F++;F<c&&!r(h,F,p);)f.colSpan++,F++;let E=p+1;for(;E<i&&o(h,E,f.x,f.x+f.colSpan);)f.rowSpan++,E++;let g=new vu(f);g.x=f.x,g.y=f.y,_D(`Missing cell at ${g.y}-${g.x}.`),s(g,h[p])}}function C(h){return h.map(function(i){if(!Array.isArray(i)){let c=Object.keys(i)[0];i=i[c],Array.isArray(i)?(i=i.slice(),i.unshift(c)):i=[c,i]}return i.map(function(c){return new vu(c)})})}function m(h){let i=C(h);return e(i),d(i),l(i),a(i),i}Fe.exports={makeTableLayout:m,layoutTable:e,addRowSpanCells:l,maxWidth:t,fillInTable:d,computeWidths:He("colSpan","desiredWidth","x",1),computeHeights:He("rowSpan","desiredHeight","y",1)}})();function He(u,e,t,D){return function(n,r){let o=[],l=[],a={};r.forEach(function(s){s.forEach(function(d){(d[u]||1)>1?l.push(d):o[d[t]]=Math.max(o[d[t]]||0,d[e]||0,D)})}),n.forEach(function(s,d){typeof s=="number"&&(o[d]=s)});for(let s=l.length-1;s>=0;s--){let d=l[s],C=d[u],m=d[t],h=o[m],i=typeof n[m]=="number"?0:1;if(typeof h=="number")for(let c=1;c<C;c++)h+=1+o[m+c],typeof n[m+c]!="number"&&i++;else h=e==="desiredWidth"?d.desiredWidth-1:1,(!a[m]||a[m]<h)&&(a[m]=h);if(d[e]>h){let c=0;for(;i>0&&d[e]>h;){if(typeof n[m+c]!="number"){let p=Math.round((d[e]-h)/i);h+=p,o[m+c]+=p,i--}c++}}}Object.assign(n,o,a);for(let s=0;s<n.length;s++)n[s]=Math.max(D,n[s]||0)}}const M=xu,ID=de,Ou=Fe.exports;class Ge extends Array{constructor(e){super();const t=ID.mergeOptions(e);if(Object.defineProperty(this,"options",{value:t,enumerable:t.debug}),t.debug){switch(typeof t.debug){case"boolean":M.setDebugLevel(M.WARN);break;case"number":M.setDebugLevel(t.debug);break;case"string":M.setDebugLevel(parseInt(t.debug,10));break;default:M.setDebugLevel(M.WARN),M.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof t.debug}`)}Object.defineProperty(this,"messages",{get(){return M.debugMessages()}})}}toString(){let e=this,t=this.options.head&&this.options.head.length;t?(e=[this.options.head],this.length&&e.push.apply(e,this)):this.options.style.head=[];let D=Ou.makeTableLayout(e);D.forEach(function(r){r.forEach(function(o){o.mergeTableOptions(this.options,D)},this)},this),Ou.computeWidths(this.options.colWidths,D),Ou.computeHeights(this.options.rowHeights,D),D.forEach(function(r){r.forEach(function(o){o.init(this.options)},this)},this);let n=[];for(let r=0;r<D.length;r++){let o=D[r],l=this.options.rowHeights[r];(r===0||!this.options.style.compact||r==1&&t)&&Tu(o,"top",n);for(let a=0;a<l;a++)Tu(o,a,n);r+1==D.length&&Tu(o,"bottom",n)}return n.join(`
|
|
68
|
+
`)}get width(){return this.toString().split(`
|
|
69
|
+
`)[0].length}}Ge.reset=()=>M.reset();function Tu(u,e,t){let D=[];u.forEach(function(r){D.push(r.draw(e))});let n=D.join("");n.length&&t.push(n)}var jD=Ge;(function(u){u.exports=jD})(ae);var ND=Vt(ae.exports);const Ru=(...u)=>{const e=new ND({chars:{top:"","top-mid":"","top-left":"","top-right":"",bottom:"","bottom-mid":"","bottom-left":"","bottom-right":"",left:"","left-mid":"",mid:"","mid-mid":"",right:"","right-mid":"",middle:" "},style:{"padding-left":0,"padding-right":0}});return e.push(...u),e},_u=(...u)=>Ru(...u).toString().split(`
|
|
70
|
+
`),WD=u=>Array.isArray(u)?`Array<${ie(u[0])}>`:ie(u),PD=u=>{const e=[];for(const t of u){if(t.type==="block"||!t.type){const D=" ",n=t.body.map(o=>D+o);n.unshift("");const r=n.join(`
|
|
71
|
+
`);e.push(Ru([$.exports.bold(`${t.title}:`)],[r]).toString())}else if(t.type==="inline"){const D=t.items.map(r=>[$.exports.bold(`${r.title}:`),r.body]),n=Ru(...D);e.push(n.toString())}e.push("")}return e.join(`
|
|
72
|
+
`)},Mu=$.exports.yellow("-"),HD="(No description)",GD="Name",YD="Version",zD="Subcommand",UD="Commands",VD="Flags",qD="Description",Ye="Usage",ZD="Examples",ze="Notes",Ue=u=>{process.stdout.write(u)},Ve=(u,e,t)=>{const D=[{title:GD,body:$.exports.red(e._name)},{title:YD,body:$.exports.yellow(e._version)}];t&&D.push({title:zD,body:$.exports.green(`${e._name} ${H(t.name)}`)}),u.push({type:"inline",items:D}),u.push({title:qD,body:[(t==null?void 0:t.description)||e._description]})},qe=(u,e)=>{const t=e.map(([D,n])=>[D,Mu,n]);u.push({title:ZD,body:_u(...t)})},cu=(u,e,t,D)=>{const{cli:n}=e,r=[];Ve(r,n),r.push({title:Ye,body:[$.exports.magenta(`$ ${n._name} ${Ju("command",e.hasRootOrAlias)} [flags]`)]});const o=[...e.hasRoot?[n._commands[w]]:[],...Object.values(n._commands)].map(l=>{const a=[typeof l.name=="symbol"?"":l.name,...zt(l.alias||[])].sort((s,d)=>s===w?-1:d===w?1:s.length-d.length).map(s=>s===""||typeof s=="symbol"?`${n._name}`:`${n._name} ${s}`).join(", ");return[$.exports.cyan(a),Mu,l.description]});return r.push({title:UD,body:_u(...o)}),t&&r.push({title:ze,body:t}),D&&qe(r,D),u(r)},Ze=(u,e,t)=>{var D;const{cli:n}=e,r=du(n._commands,t);if(!r)throw new ou(H(t));const o=[];Ve(o,n,{...r,name:H(t)});const l=((D=r.parameters)==null?void 0:D.join(" "))||void 0,a=` ${H(t)}`,s=l?` ${l}`:"",d=r.flags?" [flags]":"";return o.push({title:Ye,body:[$.exports.magenta(`$ ${n._name}${a}${s}${d}`)]}),r.flags&&o.push({title:VD,body:_u(...Object.entries(r.flags).map(([C,m])=>{const h=[re(C)];m.alias&&h.push(re(m.alias));const i=[$.exports.blue(h.join(", "))];if(i.push(Mu,m.description||HD),m.type){const c=WD(m.type);i.push($.exports.gray(`(${c})`))}return i}))}),r.notes&&o.push({title:ze,body:r.notes}),r.examples&&qe(o,r.examples),u(o)},JD=({command:u=!0,showHelpWhenNoCommand:e=!0,notes:t,examples:D,banner:n,renderer:r="cliffy"}={})=>P({setup:o=>{const l=r==="cliffy"?PD:()=>"",a=s=>{n&&Ue(`${n}
|
|
73
|
+
`),Ue(s)};return u&&(o=o.command("help","Show help",{parameters:["[command...]"],notes:["If no command is specified, show help for the CLI.","If a command is specified, show help for the command.","-h is an alias for --help."],examples:[[`$ ${o._name} help`,"Show help"],[`$ ${o._name} help <command>`,"Show help for a specific command"],[`$ ${o._name} <command> --help`,"Show help for a specific command"]]}).on("help",s=>{s.parameters.command.length?a(Ze(l,s,s.parameters.command)):a(cu(l,s,t,D))})),o.inspector((s,d)=>{const C=s.raw.mergedFlags.h||s.raw.mergedFlags.help;if(!s.hasRootOrAlias&&!s.raw._.length&&e&&!C){let m=`No command given.
|
|
74
|
+
|
|
75
|
+
`;m+=cu(l,s,t,D),m+=`
|
|
76
|
+
`,a(m),process.exit(1)}else C?s.raw._.length?s.called!==w&&s.name===w?a(cu(l,s,t,D)):a(Ze(l,s,s.raw._)):a(cu(l,s,t,D)):d()}),o}}),k=new Uint32Array(65536),KD=(u,e)=>{const t=u.length,D=e.length,n=1<<t-1;let r=-1,o=0,l=t,a=t;for(;a--;)k[u.charCodeAt(a)]|=1<<a;for(a=0;a<D;a++){let s=k[e.charCodeAt(a)];const d=s|o;s|=(s&r)+r^r,o|=~(s|r),r&=s,o&n&&l++,r&n&&l--,o=o<<1|1,r=r<<1|~(d|o),o&=d}for(a=t;a--;)k[u.charCodeAt(a)]=0;return l},QD=(u,e)=>{const t=e.length,D=u.length,n=[],r=[],o=Math.ceil(t/32),l=Math.ceil(D/32);for(let i=0;i<o;i++)r[i]=-1,n[i]=0;let a=0;for(;a<l-1;a++){let i=0,c=-1;const p=a*32,F=Math.min(32,D)+p;for(let f=p;f<F;f++)k[u.charCodeAt(f)]|=1<<f;for(let f=0;f<t;f++){const E=k[e.charCodeAt(f)],g=r[f/32|0]>>>f&1,A=n[f/32|0]>>>f&1,tu=E|i,Du=((E|A)&c)+c^c|E|A;let I=i|~(Du|c),nu=c&Du;I>>>31^g&&(r[f/32|0]^=1<<f),nu>>>31^A&&(n[f/32|0]^=1<<f),I=I<<1|g,nu=nu<<1|A,c=nu|~(tu|I),i=I&tu}for(let f=p;f<F;f++)k[u.charCodeAt(f)]=0}let s=0,d=-1;const C=a*32,m=Math.min(32,D-C)+C;for(let i=C;i<m;i++)k[u.charCodeAt(i)]|=1<<i;let h=D;for(let i=0;i<t;i++){const c=k[e.charCodeAt(i)],p=r[i/32|0]>>>i&1,F=n[i/32|0]>>>i&1,f=c|s,E=((c|F)&d)+d^d|c|F;let g=s|~(E|d),A=d&E;h+=g>>>D-1&1,h-=A>>>D-1&1,g>>>31^p&&(r[i/32|0]^=1<<i),A>>>31^F&&(n[i/32|0]^=1<<i),g=g<<1|p,A=A<<1|F,d=A|~(f|g),s=g&f}for(let i=C;i<m;i++)k[u.charCodeAt(i)]=0;return h},Je=(u,e)=>{if(u.length<e.length){const t=e;e=u,u=t}return e.length===0?u.length:u.length<=32?KD(u,e):QD(u,e)};var hu=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},XD=1/0,un="[object Symbol]",en=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,tn="\\u0300-\\u036f\\ufe20-\\ufe23",Dn="\\u20d0-\\u20f0",nn="["+tn+Dn+"]",rn=RegExp(nn,"g"),on={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},sn=typeof hu=="object"&&hu&&hu.Object===Object&&hu,an=typeof self=="object"&&self&&self.Object===Object&&self,ln=sn||an||Function("return this")();function cn(u){return function(e){return u==null?void 0:u[e]}}var hn=cn(on),pn=Object.prototype,mn=pn.toString,Ke=ln.Symbol,Qe=Ke?Ke.prototype:void 0,Xe=Qe?Qe.toString:void 0;function fn(u){if(typeof u=="string")return u;if(Fn(u))return Xe?Xe.call(u):"";var e=u+"";return e=="0"&&1/u==-XD?"-0":e}function dn(u){return!!u&&typeof u=="object"}function Fn(u){return typeof u=="symbol"||dn(u)&&mn.call(u)==un}function Cn(u){return u==null?"":fn(u)}function gn(u){return u=Cn(u),u&&u.replace(en,hn).replace(rn,"")}var En=gn;let O,T;(function(u){u.ALL_CLOSEST_MATCHES="all-closest-matches",u.ALL_MATCHES="all-matches",u.ALL_SORTED_MATCHES="all-sorted-matches",u.FIRST_CLOSEST_MATCH="first-closest-match",u.FIRST_MATCH="first-match"})(O||(O={})),function(u){u.EDIT_DISTANCE="edit-distance",u.SIMILARITY="similarity"}(T||(T={}));const ut=new Error("unknown returnType"),pu=new Error("unknown thresholdType"),et=(u,e)=>{let t=u;return e.trimSpaces&&(t=t.trim().replace(/\s+/g," ")),e.deburr&&(t=En(t)),e.caseSensitive||(t=t.toLowerCase()),t},tt=(u,e)=>{const{matchPath:t}=e,D=((n,r)=>{const o=r.length>0?r.reduce((l,a)=>l==null?void 0:l[a],n):n;return typeof o!="string"?"":o})(u,t);return et(D,e)};function Bn(u,e,t){const D=(m=>{const h={caseSensitive:!1,deburr:!0,matchPath:[],returnType:O.FIRST_CLOSEST_MATCH,thresholdType:T.SIMILARITY,trimSpaces:!0,...m};switch(h.thresholdType){case T.EDIT_DISTANCE:return{threshold:20,...h};case T.SIMILARITY:return{threshold:.4,...h};default:throw pu}})(t),{returnType:n,threshold:r,thresholdType:o}=D,l=et(u,D);let a,s;switch(o){case T.EDIT_DISTANCE:a=m=>m<=r,s=m=>Je(l,tt(m,D));break;case T.SIMILARITY:a=m=>m>=r,s=m=>((h,i)=>{if(!h||!i)return 0;if(h===i)return 1;const c=Je(h,i),p=Math.max(h.length,i.length);return(p-c)/p})(l,tt(m,D));break;default:throw pu}const d=[],C=e.length;switch(n){case O.ALL_CLOSEST_MATCHES:case O.FIRST_CLOSEST_MATCH:{const m=[];let h;switch(o){case T.EDIT_DISTANCE:h=1/0;for(let c=0;c<C;c+=1){const p=s(e[c]);h>p&&(h=p),m.push(p)}break;case T.SIMILARITY:h=0;for(let c=0;c<C;c+=1){const p=s(e[c]);h<p&&(h=p),m.push(p)}break;default:throw pu}const i=m.length;for(let c=0;c<i;c+=1){const p=m[c];a(p)&&p===h&&d.push(c)}break}case O.ALL_MATCHES:for(let m=0;m<C;m+=1)a(s(e[m]))&&d.push(m);break;case O.ALL_SORTED_MATCHES:{const m=[];for(let h=0;h<C;h+=1){const i=s(e[h]);a(i)&&m.push({score:i,index:h})}switch(o){case T.EDIT_DISTANCE:m.sort((h,i)=>h.score-i.score);break;case T.SIMILARITY:m.sort((h,i)=>i.score-h.score);break;default:throw pu}for(const h of m)d.push(h.index);break}case O.FIRST_MATCH:for(let m=0;m<C;m+=1)if(a(s(e[m]))){d.push(m);break}break;default:throw ut}return((m,h,i)=>{switch(i){case O.ALL_CLOSEST_MATCHES:case O.ALL_MATCHES:case O.ALL_SORTED_MATCHES:return h.map(c=>m[c]);case O.FIRST_CLOSEST_MATCH:case O.FIRST_MATCH:return h.length?m[h[0]]:null;default:throw ut}})(e,d,n)}var V={exports:{}};let xn=mu,bn=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||xn.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),x=(u,e,t=u)=>D=>{let n=""+D,r=n.indexOf(e,u.length);return~r?u+Dt(n,e,t,r)+e:u+n+e},Dt=(u,e,t,D)=>{let n=u.substring(0,D)+t,r=u.substring(D+e.length),o=r.indexOf(e);return~o?n+Dt(r,e,t,o):n+r},nt=(u=bn)=>({isColorSupported:u,reset:u?e=>`\x1B[0m${e}\x1B[0m`:String,bold:u?x("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?x("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?x("\x1B[3m","\x1B[23m"):String,underline:u?x("\x1B[4m","\x1B[24m"):String,inverse:u?x("\x1B[7m","\x1B[27m"):String,hidden:u?x("\x1B[8m","\x1B[28m"):String,strikethrough:u?x("\x1B[9m","\x1B[29m"):String,black:u?x("\x1B[30m","\x1B[39m"):String,red:u?x("\x1B[31m","\x1B[39m"):String,green:u?x("\x1B[32m","\x1B[39m"):String,yellow:u?x("\x1B[33m","\x1B[39m"):String,blue:u?x("\x1B[34m","\x1B[39m"):String,magenta:u?x("\x1B[35m","\x1B[39m"):String,cyan:u?x("\x1B[36m","\x1B[39m"):String,white:u?x("\x1B[37m","\x1B[39m"):String,gray:u?x("\x1B[90m","\x1B[39m"):String,bgBlack:u?x("\x1B[40m","\x1B[49m"):String,bgRed:u?x("\x1B[41m","\x1B[49m"):String,bgGreen:u?x("\x1B[42m","\x1B[49m"):String,bgYellow:u?x("\x1B[43m","\x1B[49m"):String,bgBlue:u?x("\x1B[44m","\x1B[49m"):String,bgMagenta:u?x("\x1B[45m","\x1B[49m"):String,bgCyan:u?x("\x1B[46m","\x1B[49m"):String,bgWhite:u?x("\x1B[47m","\x1B[49m"):String});V.exports=nt(),V.exports.createColors=nt;const An=u=>u.length<=1?u[0]:`${u.slice(0,-1).map(V.exports.bold).join(", ")} and ${V.exports.bold(u[u.length-1])}`,yn=()=>P({setup:u=>u.inspector({enforce:"pre",fn:(e,t)=>{const D=Object.keys(u._commands),n=!!D.length;try{t()}catch(r){if(!(r instanceof ou||r instanceof su))throw r;if(e.raw._.length===0||r instanceof su){console.error("No command given."),n&&console.error(`Possible commands: ${An(D)}.`);return}const o=r.commandName,l=Bn(o,D);console.error(`Command "${V.exports.strikethrough(o)}" not found.`),n&&l?console.error(`Did you mean "${V.exports.bold(l)}"?`):n||console.error("NOTE: You haven't register any command yet."),process.stderr.write(`
|
|
77
|
+
`),process.exit(2)}}})}),wn=u=>u.length<=1?u[0]:`${u.slice(0,-1).join(", ")} and ${u[u.length-1]}`,Sn=()=>P({setup:u=>u.inspector((e,t)=>{const D=Object.keys(e.unknownFlags);if(!e.resolved||D.length===0)t();else throw new Error(`Unexpected flag${D.length>1?"s":""}: ${wn(D)}`)})}),$n=u=>u.length===0?"":u.startsWith("v")?u:`v${u}`,vn=({alias:u=["V"],command:e=!0}={})=>P({setup:t=>{const D=$n(t._version);return e&&(t=t.command("version","Show version",{notes:['The version string begins with a "v".']}).on("version",()=>{process.stdout.write(D)})),t.inspector({enforce:"pre",fn:(n,r)=>{let o=!1;const l=["version",...u];for(const a of Object.keys(n.raw.mergedFlags))if(l.includes(a)){o=!0;break}o?process.stdout.write(D):r()}})}});var L={exports:{}};let On=mu,Tn=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||On.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),b=(u,e,t=u)=>D=>{let n=""+D,r=n.indexOf(e,u.length);return~r?u+rt(n,e,t,r)+e:u+n+e},rt=(u,e,t,D)=>{let n=u.substring(0,D)+t,r=u.substring(D+e.length),o=r.indexOf(e);return~o?n+rt(r,e,t,o):n+r},ot=(u=Tn)=>({isColorSupported:u,reset:u?e=>`\x1B[0m${e}\x1B[0m`:String,bold:u?b("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?b("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?b("\x1B[3m","\x1B[23m"):String,underline:u?b("\x1B[4m","\x1B[24m"):String,inverse:u?b("\x1B[7m","\x1B[27m"):String,hidden:u?b("\x1B[8m","\x1B[28m"):String,strikethrough:u?b("\x1B[9m","\x1B[29m"):String,black:u?b("\x1B[30m","\x1B[39m"):String,red:u?b("\x1B[31m","\x1B[39m"):String,green:u?b("\x1B[32m","\x1B[39m"):String,yellow:u?b("\x1B[33m","\x1B[39m"):String,blue:u?b("\x1B[34m","\x1B[39m"):String,magenta:u?b("\x1B[35m","\x1B[39m"):String,cyan:u?b("\x1B[36m","\x1B[39m"):String,white:u?b("\x1B[37m","\x1B[39m"):String,gray:u?b("\x1B[90m","\x1B[39m"):String,bgBlack:u?b("\x1B[40m","\x1B[49m"):String,bgRed:u?b("\x1B[41m","\x1B[49m"):String,bgGreen:u?b("\x1B[42m","\x1B[49m"):String,bgYellow:u?b("\x1B[43m","\x1B[49m"):String,bgBlue:u?b("\x1B[44m","\x1B[49m"):String,bgMagenta:u?b("\x1B[45m","\x1B[49m"):String,bgCyan:u?b("\x1B[46m","\x1B[49m"):String,bgWhite:u?b("\x1B[47m","\x1B[49m"):String});L.exports=ot(),L.exports.createColors=ot;function Rn(u){return u.split(`
|
|
78
|
+
`).splice(1).map(e=>e.trim().replace("file://",""))}function _n(u){return`
|
|
79
|
+
${Rn(u).map(e=>` ${e.replace(/^at ([\s\S]+) \((.+)\)/,(t,D,n)=>L.exports.gray(`at ${D} (${L.exports.cyan(n)})`))}`).join(`
|
|
80
|
+
`)}`}function Mn(u){return u.map(e=>typeof(e==null?void 0:e.stack)=="string"?`${e.message}
|
|
81
|
+
${_n(e.stack)}`:e)}function kn(u,e){const t=u.toUpperCase(),D=L.exports[e];return L.exports.bold(L.exports.inverse(D(` ${t} `)))}function uu(u,e,t){const D=L.exports[e],n=t!=null&&t.textColor?L.exports[t.textColor]:D,r=(t==null?void 0:t.target)||console.log;return(...o)=>{const l=Mn(o);r(`${kn(u,e)} ${n(l.join(" "))}
|
|
82
|
+
`)}}uu("log","gray"),uu("info","blue",{target:console.info}),uu("warn","yellow",{target:console.warn}),uu("success","green");const Ln=uu("error","red",{target:console.error}),In=()=>P({setup:u=>u.inspector({enforce:"pre",fn:(e,t)=>{try{t()}catch(D){Ln(D.message),process.exit(1)}}})});export{kt as Clerc,Iu as CommandExistsError,ju as CommandNameConflictError,Wu as DescriptionNotSetError,Hu as InvalidCommandNameError,Nu as NameNotSetError,su as NoCommandGivenError,ou as NoSuchCommandError,w as Root,Pu as VersionNotSetError,Yt as completionsPlugin,qu as compose,jt as defineCommand,Lt as defineHandler,It as defineInspector,P as definePlugin,H as formatCommandName,In as friendlyErrorPlugin,JD as helpPlugin,Zu as isInvalidName,yn as notFoundPlugin,Vu as resolveArgv,du as resolveCommand,Yu as resolveFlattenCommands,Uu as resolveParametersBeforeFlag,_t as resolveRootCommands,zu as resolveSubcommandsByParent,Sn as strictFlagsPlugin,vn as versionPlugin,Ju as withBrackets};
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import mu from"tty";import st from"util";import it from"os";class at{constructor(){this.listenerMap={},this.wildcardListeners=new Set}on(e,t){return e==="*"?(this.wildcardListeners.add(t),this):(this.listenerMap[e]||(this.listenerMap[e]=new Set),this.listenerMap[e].add(t),this)}emit(e,...t){return this.listenerMap[e]&&(this.wildcardListeners.forEach(D=>D(e,...t)),this.listenerMap[e].forEach(D=>D(...t))),this}off(e,t){var D,n;return e==="**"?(this.listenerMap={},this.wildcardListeners.clear(),this):e==="*"?(t?this.wildcardListeners.delete(t):this.wildcardListeners.clear(),this):(t?(D=this.listenerMap[e])==null||D.delete(t):(n=this.listenerMap[e])==null||n.clear(),this)}}const lt="known-flag",ct="unknown-flag",ht="argument",{stringify:q}=JSON,pt=/\B([A-Z])/g,mt=u=>u.replace(pt,"-$1").toLowerCase(),{hasOwnProperty:ft}=Object.prototype,Z=(u,e)=>ft.call(u,e),dt=u=>Array.isArray(u),ku=u=>typeof u=="function"?[u,!1]:dt(u)?[u[0],!0]:ku(u.type),Ft=(u,e)=>u===Boolean?e!=="false":e,Ct=(u,e)=>typeof e=="boolean"?e:u===Number&&e===""?Number.NaN:u(e),gt=/[\s.:=]/,Et=u=>{const e=`Flag name ${q(u)}`;if(u.length===0)throw new Error(`${e} cannot be empty`);if(u.length===1)throw new Error(`${e} must be longer than a character`);const t=u.match(gt);if(t)throw new Error(`${e} cannot contain ${q(t==null?void 0:t[0])}`)},Bt=u=>{const e={},t=(D,n)=>{if(Z(e,D))throw new Error(`Duplicate flags named ${q(D)}`);e[D]=n};for(const D in u){if(!Z(u,D))continue;Et(D);const n=u[D],r=[[],...ku(n),n];t(D,r);const o=mt(D);if(D!==o&&t(o,r),"alias"in n&&typeof n.alias=="string"){const{alias:l}=n,a=`Flag alias ${q(l)} for flag ${q(D)}`;if(l.length===0)throw new Error(`${a} cannot be empty`);if(l.length>1)throw new Error(`${a} must be a single character`);t(l,r)}}return e},xt=(u,e)=>{const t={};for(const D in u){if(!Z(u,D))continue;const[n,,r,o]=e[D];if(n.length===0&&"default"in o){let{default:l}=o;typeof l=="function"&&(l=l()),t[D]=l}else t[D]=r?n:n.pop()}return t},ru="--",bt=/[.:=]/,At=/^-{1,2}\w/,yt=u=>{if(!At.test(u))return;const e=!u.startsWith(ru);let t=u.slice(e?1:2),D;const n=t.match(bt);if(n){const{index:r}=n;D=t.slice(r+1),t=t.slice(0,r)}return[t,D,e]},wt=(u,{onFlag:e,onArgument:t})=>{let D;const n=(r,o)=>{if(typeof D!="function")return!0;D(r,o),D=void 0};for(let r=0;r<u.length;r+=1){const o=u[r];if(o===ru){n();const a=u.slice(r+1);t==null||t(a,[r],!0);break}const l=yt(o);if(l){if(n(),!e)continue;const[a,s,d]=l;if(d)for(let C=0;C<a.length;C+=1){n();const m=C===a.length-1;D=e(a[C],m?s:void 0,[r,C+1,m])}else D=e(a,s,[r])}else n(o,[r])&&(t==null||t([o],[r]))}n()},St=(u,e)=>{for(const[t,D,n]of e.reverse()){if(D){const r=u[t];let o=r.slice(0,D);if(n||(o+=r.slice(D+1)),o!=="-"){u[t]=o;continue}}u.splice(t,1)}},$t=(u,e=process.argv.slice(2),{ignore:t}={})=>{const D=[],n=Bt(u),r={},o=[];return o[ru]=[],wt(e,{onFlag(l,a,s){const d=Z(n,l);if(!(t!=null&&t(d?lt:ct,l,a))){if(d){const[C,m]=n[l],h=Ft(m,a),i=(c,p)=>{D.push(s),p&&D.push(p),C.push(Ct(m,c||""))};return h===void 0?i:i(h)}Z(r,l)||(r[l]=[]),r[l].push(a===void 0?!0:a),D.push(s)}},onArgument(l,a,s){t!=null&&t(ht,e[a[0]])||(o.push(...l),s?(o[ru]=l,e.splice(a[0])):D.push(a))}}),St(e,D),{flags:xt(u,n),unknownFlags:r,_:o}},fu=u=>Array.isArray(u)?u:[u],vt=u=>u.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),Ot=(u,e)=>e.length!==u.length?!1:u.every((t,D)=>t===e[D]),Lu=(u,e)=>e.length>u.length?!1:Ot(u.slice(0,e.length),e);class Iu extends Error{constructor(e){super(`Command "${e}" exists.`),this.commandName=e}}class ou extends Error{constructor(e){super(`No such command: ${e}`),this.commandName=e}}class su extends Error{constructor(){super("No command given.")}}class ju extends Error{constructor(e,t){super(`Command name ${e} conflicts with ${t}. Maybe caused by alias.`),this.n1=e,this.n2=t}}class Nu extends Error{constructor(){super("Name not set.")}}class Wu extends Error{constructor(){super("Description not set.")}}class Pu extends Error{constructor(){super("Version not set.")}}class Hu extends Error{constructor(e){super(`Bad name format: ${e}`),this.commandName=e}}function Tt(){return typeof process!="undefined"}function Rt(){return typeof Deno!="undefined"}function Gu(u,e,t){if(t.alias){const D=fu(t.alias);for(const n of D){if(n in e)throw new ju(e[n].name,t.name);u.set(typeof n=="symbol"?n:n.split(" "),{...t,__isAlias:!0})}}}function Yu(u){const e=new Map;u[w]&&(e.set(w,u[w]),Gu(e,u,u[w]));for(const t of Object.values(u))Gu(e,u,t),e.set(t.name.split(" "),t);return e}function du(u,e){if(e===w)return u[w];const t=fu(e),D=Yu(u);let n,r;return D.forEach((o,l)=>{if(l===w){n=D.get(w),r=w;return}Lu(t,l)&&(!r||r===w||l.length>r.length)&&(n=o,r=l)}),n}function zu(u,e,t=1/0){const D=e===""?[]:Array.isArray(e)?e:e.split(" ");return Object.values(u).filter(n=>{const r=n.name.split(" ");return Lu(r,D)&&r.length-D.length<=t})}const _t=u=>zu(u,"",1);function Uu(u){const e=[];for(const t of u){if(t.startsWith("-"))break;e.push(t)}return e}const Vu=()=>Tt()?process.argv.slice(2):Rt()?Deno.args:[];function qu(u){const e={pre:[],normal:[],post:[]};for(const D of u){const n=typeof D=="object"?D:{fn:D},{enforce:r,fn:o}=n;r==="post"||r==="pre"?e[r].push(o):e.normal.push(o)}const t=[...e.pre,...e.normal,...e.post];return D=>{return n(0);function n(r){const o=t[r];return o(D(),n.bind(null,r+1))}}}const Zu=u=>typeof u=="string"&&(u.startsWith(" ")||u.endsWith(" ")),Ju=(u,e)=>e?`[${u}]`:`<${u}>`,Mt="<Root>",H=u=>Array.isArray(u)?u.join(" "):typeof u=="string"?u:Mt,{stringify:G}=JSON;function Fu(u){const e=[];let t,D;for(const n of u){if(D)throw new Error(`Invalid parameter: Spread parameter ${G(D)} must be last`);const r=n[0],o=n[n.length-1];let l;if(r==="<"&&o===">"&&(l=!0,t))throw new Error(`Invalid parameter: Required parameter ${G(n)} cannot come after optional parameter ${G(t)}`);if(r==="["&&o==="]"&&(l=!1,t=n),l===void 0)throw new Error(`Invalid parameter: ${G(n)}. Must be wrapped in <> (required parameter) or [] (optional parameter)`);let a=n.slice(1,-1);const s=a.slice(-3)==="...";s&&(D=n,a=a.slice(0,-3)),e.push({name:a,required:l,spread:s})}return e}function Cu(u,e,t){for(let D=0;D<e.length;D+=1){const{name:n,required:r,spread:o}=e[D],l=vt(n);if(l in u)return new Error(`Invalid parameter: ${G(n)} is used more than once.`);const a=o?t.slice(D):t[D];if(o&&(D=e.length),r&&(!a||o&&a.length===0))return new Error(`Error: Missing required parameter ${G(n)}`);u[l]=a}}var Ku=(u,e,t)=>{if(!e.has(u))throw TypeError("Cannot "+t)},y=(u,e,t)=>(Ku(u,e,"read from private field"),t?t.call(u):e.get(u)),_=(u,e,t)=>{if(e.has(u))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(u):e.set(u,t)},Y=(u,e,t,D)=>(Ku(u,e,"write to private field"),D?D.call(u,t):e.set(u,t),t),j,N,W,J,K,iu,z,gu,Qu,Eu,Xu;const w=Symbol("Root"),ue=class{constructor(u,e,t){_(this,gu),_(this,Eu),_(this,j,""),_(this,N,""),_(this,W,""),_(this,J,[]),_(this,K,{}),_(this,iu,new at),_(this,z,new Set),Y(this,j,u||y(this,j)),Y(this,N,e||y(this,N)),Y(this,W,t||y(this,W))}get _name(){return y(this,j)}get _description(){return y(this,N)}get _version(){return y(this,W)}get _inspectors(){return y(this,J)}get _commands(){return y(this,K)}static create(u,e,t){return new ue(u,e,t)}name(u){return Y(this,j,u),this}description(u){return Y(this,N,u),this}version(u){return Y(this,W,u),this}command(u,e,t={}){const D=(s=>!(typeof s=="string"||s===w))(u),n=D?u.name:u;if(Zu(n))throw new Hu(n);const{handler:r=void 0,...o}=D?u:{name:n,description:e,...t},l=[o.name],a=o.alias?fu(o.alias):[];o.alias&&l.push(...a);for(const s of l)if(y(this,z).has(s))throw new Iu(H(s));return y(this,K)[n]=o,y(this,z).add(o.name),a.forEach(s=>y(this,z).add(s)),D&&r&&this.on(u.name,r),this}on(u,e){return y(this,iu).on(u,e),this}use(u){return u.setup(this)}inspector(u){return y(this,J).push(u),this}parse(u=Vu()){if(!y(this,j))throw new Nu;if(!y(this,N))throw new Wu;if(!y(this,W))throw new Pu;const e=Uu(u),t=e.join(" "),D=()=>du(y(this,K),e),n=[],r=()=>{n.length=0;const a=D(),s=!!a,d=$t((a==null?void 0:a.flags)||{},[...u]),{_:C,flags:m,unknownFlags:h}=d;let i=!s||a.name===w?C:C.slice(a.name.split(" ").length),c=(a==null?void 0:a.parameters)||[];const p=c.indexOf("--"),F=c.slice(p+1)||[],f=Object.create(null);if(p>-1&&F.length>0){c=c.slice(0,p);const g=C["--"];i=i.slice(0,-g.length||void 0),n.push(Cu(f,Fu(c),i)),n.push(Cu(f,Fu(F),g))}else n.push(Cu(f,Fu(c),i));const E={...m,...h};return{name:a==null?void 0:a.name,called:e.length===0&&(a==null?void 0:a.name)?w:t,resolved:s,hasRootOrAlias:y(this,gu,Qu),hasRoot:y(this,Eu,Xu),raw:{...d,parameters:i,mergedFlags:E},parameters:f,flags:m,unknownFlags:h,cli:this}},o={enforce:"post",fn:()=>{const a=D(),s=r(),d=n.filter(Boolean);if(d.length>0)throw d[0];if(!a)throw t?new ou(t):new su;y(this,iu).emit(a.name,s)}},l=[...y(this,J),o];return qu(l)(r),this}};let kt=ue;j=new WeakMap,N=new WeakMap,W=new WeakMap,J=new WeakMap,K=new WeakMap,iu=new WeakMap,z=new WeakMap,gu=new WeakSet,Qu=function(){return y(this,z).has(w)},Eu=new WeakSet,Xu=function(){return Object.prototype.hasOwnProperty.call(this._commands,w)};const P=u=>u,Lt=(u,e,t)=>t,It=(u,e)=>e,jt=(u,e)=>({...u,handler:e}),Nt=u=>`
|
|
2
|
+
${u})
|
|
3
|
+
cmd+="__${u}"
|
|
4
|
+
;;`,Wt=u=>{const{cli:e}=u,{_name:t,_commands:D}=e;return`_${t}() {
|
|
5
|
+
local i cur prev opts cmds
|
|
6
|
+
COMPREPLY=()
|
|
7
|
+
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
8
|
+
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
9
|
+
cmd=""
|
|
10
|
+
opts=""
|
|
11
|
+
|
|
12
|
+
for i in \${COMP_WORDS[@]}
|
|
13
|
+
do
|
|
14
|
+
case "\${i}" in
|
|
15
|
+
"$1")
|
|
16
|
+
cmd="${t}"
|
|
17
|
+
;;
|
|
18
|
+
${Object.keys(D).map(Nt).join("")}
|
|
19
|
+
*)
|
|
20
|
+
;;
|
|
21
|
+
esac
|
|
22
|
+
done
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
complete -F _${t} -o bashdefault -o default ${t}
|
|
26
|
+
`},ee=u=>u.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`),te=u=>u.length<=1?`-${u}`:`--${ee(u)}`,De="(No Description)",Pt=u=>`[CompletionResult]::new('${u.name}', '${u.name}', [CompletionResultType]::ParameterValue, '${u.description}')`,Ht=u=>Object.entries(u.flags||{}).map(([e,t])=>{const D=[`[CompletionResult]::new('${te(e)}', '${ee(e)}', [CompletionResultType]::ParameterName, '${u.flags[e].description||De}')`];return t!=null&&t.alias&&D.push(`[CompletionResult]::new('${te(t.alias)}', '${t.alias}', [CompletionResultType]::ParameterName, '${u.flags[e].description||De}')`),D.join(`
|
|
27
|
+
`)}).join(`
|
|
28
|
+
`),Gt=u=>{const{cli:e}=u,{_name:t,_commands:D}=e;return`using namespace System.Management.Automation
|
|
29
|
+
using namespace System.Management.Automation.Language
|
|
30
|
+
|
|
31
|
+
Register-ArgumentCompleter -Native -CommandName '${t}' -ScriptBlock {
|
|
32
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
33
|
+
|
|
34
|
+
$commandElements = $commandAst.CommandElements
|
|
35
|
+
$command = @(
|
|
36
|
+
'${t}'
|
|
37
|
+
for ($i = 1; $i -lt $commandElements.Count; $i++) {
|
|
38
|
+
$element = $commandElements[$i]
|
|
39
|
+
if ($element -isnot [StringConstantExpressionAst] -or
|
|
40
|
+
$element.StringConstantType -ne [StringConstantType]::BareWord -or
|
|
41
|
+
$element.Value.StartsWith('-') -or
|
|
42
|
+
$element.Value -eq $wordToComplete) {
|
|
43
|
+
break
|
|
44
|
+
}
|
|
45
|
+
$element.Value
|
|
46
|
+
}) -join ';'
|
|
47
|
+
|
|
48
|
+
$completions = @(switch ($command) {
|
|
49
|
+
'${t}' {
|
|
50
|
+
${Object.entries(D).map(([n,r])=>Pt(r)).join(`
|
|
51
|
+
`)}
|
|
52
|
+
break
|
|
53
|
+
}
|
|
54
|
+
${Object.entries(D).map(([n,r])=>`'${t};${n.split(" ").join(";")}' {
|
|
55
|
+
${Ht(r)}
|
|
56
|
+
break
|
|
57
|
+
}`).join(`
|
|
58
|
+
`)}
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
$completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
|
|
62
|
+
Sort-Object -Property ListItemText
|
|
63
|
+
}`},ne={bash:Wt,pwsh:Gt},Yt=(u={})=>P({setup:e=>{const{command:t=!0}=u;return t&&(e=e.command("completions","Print shell completions to stdout",{flags:{shell:{description:"Shell type",type:String,default:""}},parameters:["[shell]"]}).on("completions",D=>{if(!e._name)throw new Error("CLI name is not defined!");const n=String(D.parameters.shell||D.flags.shell);if(!n)throw new Error("Missing shell name");if(n in ne)process.stdout.write(ne[n](D));else throw new Error(`No such shell: ${n}`)})),e}}),zt=u=>Array.isArray(u)?u:[u],Ut=u=>u.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`),re=u=>u.length<=1?`-${u}`:`--${Ut(u)}`;function Vt(u){return u&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u}var $={exports:{}};let qt=mu,Zt=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||qt.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),B=(u,e,t=u)=>D=>{let n=""+D,r=n.indexOf(e,u.length);return~r?u+oe(n,e,t,r)+e:u+n+e},oe=(u,e,t,D)=>{let n=u.substring(0,D)+t,r=u.substring(D+e.length),o=r.indexOf(e);return~o?n+oe(r,e,t,o):n+r},se=(u=Zt)=>({isColorSupported:u,reset:u?e=>`\x1B[0m${e}\x1B[0m`:String,bold:u?B("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?B("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?B("\x1B[3m","\x1B[23m"):String,underline:u?B("\x1B[4m","\x1B[24m"):String,inverse:u?B("\x1B[7m","\x1B[27m"):String,hidden:u?B("\x1B[8m","\x1B[28m"):String,strikethrough:u?B("\x1B[9m","\x1B[29m"):String,black:u?B("\x1B[30m","\x1B[39m"):String,red:u?B("\x1B[31m","\x1B[39m"):String,green:u?B("\x1B[32m","\x1B[39m"):String,yellow:u?B("\x1B[33m","\x1B[39m"):String,blue:u?B("\x1B[34m","\x1B[39m"):String,magenta:u?B("\x1B[35m","\x1B[39m"):String,cyan:u?B("\x1B[36m","\x1B[39m"):String,white:u?B("\x1B[37m","\x1B[39m"):String,gray:u?B("\x1B[90m","\x1B[39m"):String,bgBlack:u?B("\x1B[40m","\x1B[49m"):String,bgRed:u?B("\x1B[41m","\x1B[49m"):String,bgGreen:u?B("\x1B[42m","\x1B[49m"):String,bgYellow:u?B("\x1B[43m","\x1B[49m"):String,bgBlue:u?B("\x1B[44m","\x1B[49m"):String,bgMagenta:u?B("\x1B[45m","\x1B[49m"):String,bgCyan:u?B("\x1B[46m","\x1B[49m"):String,bgWhite:u?B("\x1B[47m","\x1B[49m"):String});$.exports=se(),$.exports.createColors=se;var Jt=Function.prototype.toString,Kt=/\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;function Qt(u){if(typeof u!="function")return null;var e="";if(typeof Function.prototype.name=="undefined"&&typeof u.name=="undefined"){var t=Jt.call(u).match(Kt);t&&(e=t[1])}else e=u.name;return e}var ie=Qt,ae={exports:{}};let Bu=[],le=0;const S=(u,e)=>{le>=e&&Bu.push(u)};S.WARN=1,S.INFO=2,S.DEBUG=3,S.reset=()=>{Bu=[]},S.setDebugLevel=u=>{le=u},S.warn=u=>S(u,S.WARN),S.info=u=>S(u,S.INFO),S.debug=u=>S(u,S.DEBUG),S.debugMessages=()=>Bu;var xu=S,bu={exports:{}},Xt=({onlyFirst:u=!1}={})=>{const e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,u?void 0:"g")};const uD=Xt;var eD=u=>typeof u=="string"?u.replace(uD(),""):u,Au={exports:{}};const ce=u=>Number.isNaN(u)?!1:u>=4352&&(u<=4447||u===9001||u===9002||11904<=u&&u<=12871&&u!==12351||12880<=u&&u<=19903||19968<=u&&u<=42182||43360<=u&&u<=43388||44032<=u&&u<=55203||63744<=u&&u<=64255||65040<=u&&u<=65049||65072<=u&&u<=65131||65281<=u&&u<=65376||65504<=u&&u<=65510||110592<=u&&u<=110593||127488<=u&&u<=127569||131072<=u&&u<=262141);Au.exports=ce,Au.exports.default=ce;var tD=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};const DD=eD,nD=Au.exports,rD=tD,he=u=>{if(typeof u!="string"||u.length===0||(u=DD(u),u.length===0))return 0;u=u.replace(rD()," ");let e=0;for(let t=0;t<u.length;t++){const D=u.codePointAt(t);D<=31||D>=127&&D<=159||D>=768&&D<=879||(D>65535&&t++,e+=nD(D)?2:1)}return e};bu.exports=he,bu.exports.default=he;const pe=bu.exports;function au(u){return u?/\u001b\[((?:\d*;){0,5}\d*)m/g:/\u001b\[(?:\d*;){0,5}\d*m/g}function R(u){let e=au();return(""+u).replace(e,"").split(`
|
|
64
|
+
`).reduce(function(t,D){return pe(D)>t?pe(D):t},0)}function Q(u,e){return Array(e+1).join(u)}function oD(u,e,t,D){let n=R(u);if(e+1>=n){let r=e-n;switch(D){case"right":{u=Q(t,r)+u;break}case"center":{let o=Math.ceil(r/2),l=r-o;u=Q(t,l)+u+Q(t,o);break}default:{u=u+Q(t,r);break}}}return u}let U={};function X(u,e,t){e="\x1B["+e+"m",t="\x1B["+t+"m",U[e]={set:u,to:!0},U[t]={set:u,to:!1},U[u]={on:e,off:t}}X("bold",1,22),X("italics",3,23),X("underline",4,24),X("inverse",7,27),X("strikethrough",9,29);function me(u,e){let t=e[1]?parseInt(e[1].split(";")[0]):0;if(t>=30&&t<=39||t>=90&&t<=97){u.lastForegroundAdded=e[0];return}if(t>=40&&t<=49||t>=100&&t<=107){u.lastBackgroundAdded=e[0];return}if(t===0){for(let n in u)Object.prototype.hasOwnProperty.call(u,n)&&delete u[n];return}let D=U[e[0]];D&&(u[D.set]=D.to)}function sD(u){let e=au(!0),t=e.exec(u),D={};for(;t!==null;)me(D,t),t=e.exec(u);return D}function fe(u,e){let t=u.lastBackgroundAdded,D=u.lastForegroundAdded;return delete u.lastBackgroundAdded,delete u.lastForegroundAdded,Object.keys(u).forEach(function(n){u[n]&&(e+=U[n].off)}),t&&t!="\x1B[49m"&&(e+="\x1B[49m"),D&&D!="\x1B[39m"&&(e+="\x1B[39m"),e}function iD(u,e){let t=u.lastBackgroundAdded,D=u.lastForegroundAdded;return delete u.lastBackgroundAdded,delete u.lastForegroundAdded,Object.keys(u).forEach(function(n){u[n]&&(e=U[n].on+e)}),t&&t!="\x1B[49m"&&(e=t+e),D&&D!="\x1B[39m"&&(e=D+e),e}function aD(u,e){if(u.length===R(u))return u.substr(0,e);for(;R(u)>e;)u=u.slice(0,-1);return u}function lD(u,e){let t=au(!0),D=u.split(au()),n=0,r=0,o="",l,a={};for(;r<e;){l=t.exec(u);let s=D[n];if(n++,r+R(s)>e&&(s=aD(s,e-r)),o+=s,r+=R(s),r<e){if(!l)break;o+=l[0],me(a,l)}}return fe(a,o)}function cD(u,e,t){return t=t||"\u2026",R(u)<=e?u:(e-=R(t),lD(u,e)+t)}function hD(){return{chars:{top:"\u2500","top-mid":"\u252C","top-left":"\u250C","top-right":"\u2510",bottom:"\u2500","bottom-mid":"\u2534","bottom-left":"\u2514","bottom-right":"\u2518",left:"\u2502","left-mid":"\u251C",mid:"\u2500","mid-mid":"\u253C",right:"\u2502","right-mid":"\u2524",middle:"\u2502"},truncate:"\u2026",colWidths:[],rowHeights:[],colAligns:[],rowAligns:[],style:{"padding-left":1,"padding-right":1,head:["red"],border:["grey"],compact:!1},head:[]}}function pD(u,e){u=u||{},e=e||hD();let t=Object.assign({},e,u);return t.chars=Object.assign({},e.chars,u.chars),t.style=Object.assign({},e.style,u.style),t}function mD(u,e){let t=[],D=e.split(/(\s+)/g),n=[],r=0,o;for(let l=0;l<D.length;l+=2){let a=D[l],s=r+R(a);r>0&&o&&(s+=o.length),s>u?(r!==0&&t.push(n.join("")),n=[a],r=R(a)):(n.push(o||"",a),r=s),o=D[l+1]}return r&&t.push(n.join("")),t}function fD(u,e){let t=[],D="";function n(o,l){for(D.length&&l&&(D+=l),D+=o;D.length>u;)t.push(D.slice(0,u)),D=D.slice(u)}let r=e.split(/(\s+)/g);for(let o=0;o<r.length;o+=2)n(r[o],o&&r[o-1]);return D.length&&t.push(D),t}function dD(u,e,t=!0){let D=[];e=e.split(`
|
|
65
|
+
`);const n=t?mD:fD;for(let r=0;r<e.length;r++)D.push.apply(D,n(u,e[r]));return D}function FD(u){let e={},t=[];for(let D=0;D<u.length;D++){let n=iD(e,u[D]);e=sD(n);let r=Object.assign({},e);t.push(fe(r,n))}return t}function CD(u,e){const t="\x1B]",D="\x07",n=";";return[t,"8",n,n,u||e,D,e,t,"8",n,n,D].join("")}var de={strlen:R,repeat:Q,pad:oD,truncate:cD,mergeOptions:pD,wordWrap:dD,colorizeLines:FD,hyperlink:CD},Fe={exports:{}},lu={exports:{}},Ce={exports:{}},ge={exports:{}},Ee={exports:{}},Be;function gD(){return Be||(Be=1,function(u){var e={};u.exports=e;var t={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(t).forEach(function(D){var n=t[D],r=e[D]=[];r.open="\x1B["+n[0]+"m",r.close="\x1B["+n[1]+"m"})}(Ee)),Ee.exports}var xe,be;function ED(){return be||(be=1,xe=function(u,e){e=e||process.argv;var t=e.indexOf("--"),D=/^-{1,2}/.test(u)?"":"--",n=e.indexOf(D+u);return n!==-1&&(t===-1?!0:n<t)}),xe}var yu,Ae;function BD(){if(Ae)return yu;Ae=1;var u=it,e=ED(),t=process.env,D=void 0;e("no-color")||e("no-colors")||e("color=false")?D=!1:(e("color")||e("colors")||e("color=true")||e("color=always"))&&(D=!0),"FORCE_COLOR"in t&&(D=t.FORCE_COLOR.length===0||parseInt(t.FORCE_COLOR,10)!==0);function n(l){return l===0?!1:{level:l,hasBasic:!0,has256:l>=2,has16m:l>=3}}function r(l){if(D===!1)return 0;if(e("color=16m")||e("color=full")||e("color=truecolor"))return 3;if(e("color=256"))return 2;if(l&&!l.isTTY&&D!==!0)return 0;var a=D?1:0;if(process.platform==="win32"){var s=u.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in t)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(C){return C in t})||t.CI_NAME==="codeship"?1:a;if("TEAMCITY_VERSION"in t)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(t.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in t){var d=parseInt((t.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(t.TERM_PROGRAM){case"iTerm.app":return d>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(t.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(t.TERM)||"COLORTERM"in t?1:(t.TERM,a)}function o(l){var a=r(l);return n(a)}return yu={supportsColor:o,stdout:o(process.stdout),stderr:o(process.stderr)},yu}var ye={exports:{}},we;function xD(){return we||(we=1,function(u){u.exports=function(e,t){var D="";e=e||"Run the trap, drop the bass",e=e.split("");var n={a:["@","\u0104","\u023A","\u0245","\u0394","\u039B","\u0414"],b:["\xDF","\u0181","\u0243","\u026E","\u03B2","\u0E3F"],c:["\xA9","\u023B","\u03FE"],d:["\xD0","\u018A","\u0500","\u0501","\u0502","\u0503"],e:["\xCB","\u0115","\u018E","\u0258","\u03A3","\u03BE","\u04BC","\u0A6C"],f:["\u04FA"],g:["\u0262"],h:["\u0126","\u0195","\u04A2","\u04BA","\u04C7","\u050A"],i:["\u0F0F"],j:["\u0134"],k:["\u0138","\u04A0","\u04C3","\u051E"],l:["\u0139"],m:["\u028D","\u04CD","\u04CE","\u0520","\u0521","\u0D69"],n:["\xD1","\u014B","\u019D","\u0376","\u03A0","\u048A"],o:["\xD8","\xF5","\xF8","\u01FE","\u0298","\u047A","\u05DD","\u06DD","\u0E4F"],p:["\u01F7","\u048E"],q:["\u09CD"],r:["\xAE","\u01A6","\u0210","\u024C","\u0280","\u042F"],s:["\xA7","\u03DE","\u03DF","\u03E8"],t:["\u0141","\u0166","\u0373"],u:["\u01B1","\u054D"],v:["\u05D8"],w:["\u0428","\u0460","\u047C","\u0D70"],x:["\u04B2","\u04FE","\u04FC","\u04FD"],y:["\xA5","\u04B0","\u04CB"],z:["\u01B5","\u0240"]};return e.forEach(function(r){r=r.toLowerCase();var o=n[r]||[" "],l=Math.floor(Math.random()*o.length);typeof n[r]!="undefined"?D+=n[r][l]:D+=r}),D}}(ye)),ye.exports}var Se={exports:{}},$e;function bD(){return $e||($e=1,function(u){u.exports=function(e,t){e=e||" he is here ";var D={up:["\u030D","\u030E","\u0304","\u0305","\u033F","\u0311","\u0306","\u0310","\u0352","\u0357","\u0351","\u0307","\u0308","\u030A","\u0342","\u0313","\u0308","\u034A","\u034B","\u034C","\u0303","\u0302","\u030C","\u0350","\u0300","\u0301","\u030B","\u030F","\u0312","\u0313","\u0314","\u033D","\u0309","\u0363","\u0364","\u0365","\u0366","\u0367","\u0368","\u0369","\u036A","\u036B","\u036C","\u036D","\u036E","\u036F","\u033E","\u035B","\u0346","\u031A"],down:["\u0316","\u0317","\u0318","\u0319","\u031C","\u031D","\u031E","\u031F","\u0320","\u0324","\u0325","\u0326","\u0329","\u032A","\u032B","\u032C","\u032D","\u032E","\u032F","\u0330","\u0331","\u0332","\u0333","\u0339","\u033A","\u033B","\u033C","\u0345","\u0347","\u0348","\u0349","\u034D","\u034E","\u0353","\u0354","\u0355","\u0356","\u0359","\u035A","\u0323"],mid:["\u0315","\u031B","\u0300","\u0301","\u0358","\u0321","\u0322","\u0327","\u0328","\u0334","\u0335","\u0336","\u035C","\u035D","\u035E","\u035F","\u0360","\u0362","\u0338","\u0337","\u0361"," \u0489"]},n=[].concat(D.up,D.down,D.mid);function r(a){var s=Math.floor(Math.random()*a);return s}function o(a){var s=!1;return n.filter(function(d){s=d===a}),s}function l(a,s){var d="",C,m;s=s||{},s.up=typeof s.up!="undefined"?s.up:!0,s.mid=typeof s.mid!="undefined"?s.mid:!0,s.down=typeof s.down!="undefined"?s.down:!0,s.size=typeof s.size!="undefined"?s.size:"maxi",a=a.split("");for(m in a)if(!o(m)){switch(d=d+a[m],C={up:0,down:0,mid:0},s.size){case"mini":C.up=r(8),C.mid=r(2),C.down=r(8);break;case"maxi":C.up=r(16)+3,C.mid=r(4)+1,C.down=r(64)+3;break;default:C.up=r(8)+1,C.mid=r(6)/2,C.down=r(8)+1;break}var h=["up","mid","down"];for(var i in h)for(var c=h[i],p=0;p<=C[c];p++)s[c]&&(d=d+D[c][r(D[c].length)])}return d}return l(e,t)}}(Se)),Se.exports}var ve={exports:{}},Oe;function AD(){return Oe||(Oe=1,function(u){u.exports=function(e){return function(t,D,n){if(t===" ")return t;switch(D%3){case 0:return e.red(t);case 1:return e.white(t);case 2:return e.blue(t)}}}}(ve)),ve.exports}var Te={exports:{}},Re;function yD(){return Re||(Re=1,function(u){u.exports=function(e){return function(t,D,n){return D%2===0?t:e.inverse(t)}}}(Te)),Te.exports}var _e={exports:{}},Me;function wD(){return Me||(Me=1,function(u){u.exports=function(e){var t=["red","yellow","green","blue","magenta"];return function(D,n,r){return D===" "?D:e[t[n++%t.length]](D)}}}(_e)),_e.exports}var ke={exports:{}},Le;function SD(){return Le||(Le=1,function(u){u.exports=function(e){var t=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(D,n,r){return D===" "?D:e[t[Math.round(Math.random()*(t.length-2))]](D)}}}(ke)),ke.exports}var Ie;function $D(){return Ie||(Ie=1,function(u){var e={};u.exports=e,e.themes={};var t=st,D=e.styles=gD(),n=Object.defineProperties,r=new RegExp(/[\r\n]+/g);e.supportsColor=BD().supportsColor,typeof e.enabled=="undefined"&&(e.enabled=e.supportsColor()!==!1),e.enable=function(){e.enabled=!0},e.disable=function(){e.enabled=!1},e.stripColors=e.strip=function(c){return(""+c).replace(/\x1B\[\d+m/g,"")},e.stylize=function(c,p){if(!e.enabled)return c+"";var F=D[p];return!F&&p in e?e[p](c):F.open+c+F.close};var o=/[|\\{}()[\]^$+*?.]/g,l=function(c){if(typeof c!="string")throw new TypeError("Expected a string");return c.replace(o,"\\$&")};function a(c){var p=function F(){return C.apply(F,arguments)};return p._styles=c,p.__proto__=d,p}var s=function(){var c={};return D.grey=D.gray,Object.keys(D).forEach(function(p){D[p].closeRe=new RegExp(l(D[p].close),"g"),c[p]={get:function(){return a(this._styles.concat(p))}}}),c}(),d=n(function(){},s);function C(){var c=Array.prototype.slice.call(arguments),p=c.map(function(A){return A!=null&&A.constructor===String?A:t.inspect(A)}).join(" ");if(!e.enabled||!p)return p;for(var F=p.indexOf(`
|
|
66
|
+
`)!=-1,f=this._styles,E=f.length;E--;){var g=D[f[E]];p=g.open+p.replace(g.closeRe,g.open)+g.close,F&&(p=p.replace(r,function(A){return g.close+A+g.open}))}return p}e.setTheme=function(c){if(typeof c=="string"){console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");return}for(var p in c)(function(F){e[F]=function(f){if(typeof c[F]=="object"){var E=f;for(var g in c[F])E=e[c[F][g]](E);return E}return e[c[F]](f)}})(p)};function m(){var c={};return Object.keys(s).forEach(function(p){c[p]={get:function(){return a([p])}}}),c}var h=function(c,p){var F=p.split("");return F=F.map(c),F.join("")};e.trap=xD(),e.zalgo=bD(),e.maps={},e.maps.america=AD()(e),e.maps.zebra=yD()(e),e.maps.rainbow=wD()(e),e.maps.random=SD()(e);for(var i in e.maps)(function(c){e[c]=function(p){return h(e.maps[c],p)}})(i);n(e,m())}(ge)),ge.exports}var je;function vD(){return je||(je=1,function(u){var e=$D();u.exports=e}(Ce)),Ce.exports}const{info:OD,debug:Ne}=xu,v=de;class eu{constructor(e){this.setOptions(e),this.x=null,this.y=null}setOptions(e){["boolean","number","string"].indexOf(typeof e)!==-1&&(e={content:""+e}),e=e||{},this.options=e;let t=e.content;if(["boolean","number","string"].indexOf(typeof t)!==-1)this.content=String(t);else if(!t)this.content=this.options.href||"";else throw new Error("Content needs to be a primitive, got: "+typeof t);this.colSpan=e.colSpan||1,this.rowSpan=e.rowSpan||1,this.options.href&&Object.defineProperty(this,"href",{get(){return this.options.href}})}mergeTableOptions(e,t){this.cells=t;let D=this.options.chars||{},n=e.chars,r=this.chars={};RD.forEach(function(a){$u(D,n,a,r)}),this.truncate=this.options.truncate||e.truncate;let o=this.options.style=this.options.style||{},l=e.style;$u(o,l,"padding-left",this),$u(o,l,"padding-right",this),this.head=o.head||l.head,this.border=o.border||l.border,this.fixedWidth=e.colWidths[this.x],this.lines=this.computeLines(e),this.desiredWidth=v.strlen(this.content)+this.paddingLeft+this.paddingRight,this.desiredHeight=this.lines.length}computeLines(e){const t=e.wordWrap||e.textWrap,{wordWrap:D=t}=this.options;if(this.fixedWidth&&D){if(this.fixedWidth-=this.paddingLeft+this.paddingRight,this.colSpan){let o=1;for(;o<this.colSpan;)this.fixedWidth+=e.colWidths[this.x+o],o++}const{wrapOnWordBoundary:n=!0}=e,{wrapOnWordBoundary:r=n}=this.options;return this.wrapLines(v.wordWrap(this.fixedWidth,this.content,r))}return this.wrapLines(this.content.split(`
|
|
67
|
+
`))}wrapLines(e){const t=v.colorizeLines(e);return this.href?t.map(D=>v.hyperlink(this.href,D)):t}init(e){let t=this.x,D=this.y;this.widths=e.colWidths.slice(t,t+this.colSpan),this.heights=e.rowHeights.slice(D,D+this.rowSpan),this.width=this.widths.reduce(Pe,-1),this.height=this.heights.reduce(Pe,-1),this.hAlign=this.options.hAlign||e.colAligns[t],this.vAlign=this.options.vAlign||e.rowAligns[D],this.drawRight=t+this.colSpan==e.colWidths.length}draw(e,t){if(e=="top")return this.drawTop(this.drawRight);if(e=="bottom")return this.drawBottom(this.drawRight);let D=v.truncate(this.content,10,this.truncate);e||OD(`${this.y}-${this.x}: ${this.rowSpan-e}x${this.colSpan} Cell ${D}`);let n=Math.max(this.height-this.lines.length,0),r;switch(this.vAlign){case"center":r=Math.ceil(n/2);break;case"bottom":r=n;break;default:r=0}if(e<r||e>=r+this.lines.length)return this.drawEmpty(this.drawRight,t);let o=this.lines.length>this.height&&e+1>=this.height;return this.drawLine(e-r,this.drawRight,o,t)}drawTop(e){let t=[];return this.cells?this.widths.forEach(function(D,n){t.push(this._topLeftChar(n)),t.push(v.repeat(this.chars[this.y==0?"top":"mid"],D))},this):(t.push(this._topLeftChar(0)),t.push(v.repeat(this.chars[this.y==0?"top":"mid"],this.width))),e&&t.push(this.chars[this.y==0?"topRight":"rightMid"]),this.wrapWithStyleColors("border",t.join(""))}_topLeftChar(e){let t=this.x+e,D;if(this.y==0)D=t==0?"topLeft":e==0?"topMid":"top";else if(t==0)D="leftMid";else if(D=e==0?"midMid":"bottomMid",this.cells&&(this.cells[this.y-1][t]instanceof eu.ColSpanCell&&(D=e==0?"topMid":"mid"),e==0)){let n=1;for(;this.cells[this.y][t-n]instanceof eu.ColSpanCell;)n++;this.cells[this.y][t-n]instanceof eu.RowSpanCell&&(D="leftMid")}return this.chars[D]}wrapWithStyleColors(e,t){if(this[e]&&this[e].length)try{let D=vD();for(let n=this[e].length-1;n>=0;n--)D=D[this[e][n]];return D(t)}catch(D){return t}else return t}drawLine(e,t,D,n){let r=this.chars[this.x==0?"left":"middle"];if(this.x&&n&&this.cells){let m=this.cells[this.y+n][this.x-1];for(;m instanceof wu;)m=this.cells[m.y][m.x-1];m instanceof Su||(r=this.chars.rightMid)}let o=v.repeat(" ",this.paddingLeft),l=t?this.chars.right:"",a=v.repeat(" ",this.paddingRight),s=this.lines[e],d=this.width-(this.paddingLeft+this.paddingRight);D&&(s+=this.truncate||"\u2026");let C=v.truncate(s,d,this.truncate);return C=v.pad(C,d," ",this.hAlign),C=o+C+a,this.stylizeLine(r,C,l)}stylizeLine(e,t,D){return e=this.wrapWithStyleColors("border",e),D=this.wrapWithStyleColors("border",D),this.y===0&&(t=this.wrapWithStyleColors("head",t)),e+t+D}drawBottom(e){let t=this.chars[this.x==0?"bottomLeft":"bottomMid"],D=v.repeat(this.chars.bottom,this.width),n=e?this.chars.bottomRight:"";return this.wrapWithStyleColors("border",t+D+n)}drawEmpty(e,t){let D=this.chars[this.x==0?"left":"middle"];if(this.x&&t&&this.cells){let o=this.cells[this.y+t][this.x-1];for(;o instanceof wu;)o=this.cells[o.y][o.x-1];o instanceof Su||(D=this.chars.rightMid)}let n=e?this.chars.right:"",r=v.repeat(" ",this.width);return this.stylizeLine(D,r,n)}}class wu{constructor(){}draw(e){return typeof e=="number"&&Ne(`${this.y}-${this.x}: 1x1 ColSpanCell`),""}init(){}mergeTableOptions(){}}class Su{constructor(e){this.originalCell=e}init(e){let t=this.y,D=this.originalCell.y;this.cellOffset=t-D,this.offset=TD(e.rowHeights,D,this.cellOffset)}draw(e){return e=="top"?this.originalCell.draw(this.offset,this.cellOffset):e=="bottom"?this.originalCell.draw("bottom"):(Ne(`${this.y}-${this.x}: 1x${this.colSpan} RowSpanCell for ${this.originalCell.content}`),this.originalCell.draw(this.offset+1+e))}mergeTableOptions(){}}function We(...u){return u.filter(e=>e!=null).shift()}function $u(u,e,t,D){let n=t.split("-");n.length>1?(n[1]=n[1].charAt(0).toUpperCase()+n[1].substr(1),n=n.join(""),D[n]=We(u[n],u[t],e[n],e[t])):D[t]=We(u[t],e[t])}function TD(u,e,t){let D=u[e];for(let n=1;n<t;n++)D+=1+u[e+n];return D}function Pe(u,e){return u+e+1}let RD=["top","top-mid","top-left","top-right","bottom","bottom-mid","bottom-left","bottom-right","left","left-mid","mid","mid-mid","right","right-mid","middle"];lu.exports=eu,lu.exports.ColSpanCell=wu,lu.exports.RowSpanCell=Su;const{warn:_D,debug:MD}=xu,vu=lu.exports,{ColSpanCell:kD,RowSpanCell:LD}=vu;(function(){function u(h,i){return h[i]>0?u(h,i+1):i}function e(h){let i={};h.forEach(function(c,p){let F=0;c.forEach(function(f){f.y=p,f.x=p?u(i,F):F;const E=f.rowSpan||1,g=f.colSpan||1;if(E>1)for(let A=0;A<g;A++)i[f.x+A]=E;F=f.x+g}),Object.keys(i).forEach(f=>{i[f]--,i[f]<1&&delete i[f]})})}function t(h){let i=0;return h.forEach(function(c){c.forEach(function(p){i=Math.max(i,p.x+(p.colSpan||1))})}),i}function D(h){return h.length}function n(h,i){let c=h.y,p=h.y-1+(h.rowSpan||1),F=i.y,f=i.y-1+(i.rowSpan||1),E=!(c>f||F>p),g=h.x,A=h.x-1+(h.colSpan||1),tu=i.x,Du=i.x-1+(i.colSpan||1),I=!(g>Du||tu>A);return E&&I}function r(h,i,c){let p=Math.min(h.length-1,c),F={x:i,y:c};for(let f=0;f<=p;f++){let E=h[f];for(let g=0;g<E.length;g++)if(n(F,E[g]))return!0}return!1}function o(h,i,c,p){for(let F=c;F<p;F++)if(r(h,F,i))return!1;return!0}function l(h){h.forEach(function(i,c){i.forEach(function(p){for(let F=1;F<p.rowSpan;F++){let f=new LD(p);f.x=p.x,f.y=p.y+F,f.colSpan=p.colSpan,s(f,h[c+F])}})})}function a(h){for(let i=h.length-1;i>=0;i--){let c=h[i];for(let p=0;p<c.length;p++){let F=c[p];for(let f=1;f<F.colSpan;f++){let E=new kD;E.x=F.x+f,E.y=F.y,c.splice(p+1,0,E)}}}}function s(h,i){let c=0;for(;c<i.length&&i[c].x<h.x;)c++;i.splice(c,0,h)}function d(h){let i=D(h),c=t(h);MD(`Max rows: ${i}; Max cols: ${c}`);for(let p=0;p<i;p++)for(let F=0;F<c;F++)if(!r(h,F,p)){let f={x:F,y:p,colSpan:1,rowSpan:1};for(F++;F<c&&!r(h,F,p);)f.colSpan++,F++;let E=p+1;for(;E<i&&o(h,E,f.x,f.x+f.colSpan);)f.rowSpan++,E++;let g=new vu(f);g.x=f.x,g.y=f.y,_D(`Missing cell at ${g.y}-${g.x}.`),s(g,h[p])}}function C(h){return h.map(function(i){if(!Array.isArray(i)){let c=Object.keys(i)[0];i=i[c],Array.isArray(i)?(i=i.slice(),i.unshift(c)):i=[c,i]}return i.map(function(c){return new vu(c)})})}function m(h){let i=C(h);return e(i),d(i),l(i),a(i),i}Fe.exports={makeTableLayout:m,layoutTable:e,addRowSpanCells:l,maxWidth:t,fillInTable:d,computeWidths:He("colSpan","desiredWidth","x",1),computeHeights:He("rowSpan","desiredHeight","y",1)}})();function He(u,e,t,D){return function(n,r){let o=[],l=[],a={};r.forEach(function(s){s.forEach(function(d){(d[u]||1)>1?l.push(d):o[d[t]]=Math.max(o[d[t]]||0,d[e]||0,D)})}),n.forEach(function(s,d){typeof s=="number"&&(o[d]=s)});for(let s=l.length-1;s>=0;s--){let d=l[s],C=d[u],m=d[t],h=o[m],i=typeof n[m]=="number"?0:1;if(typeof h=="number")for(let c=1;c<C;c++)h+=1+o[m+c],typeof n[m+c]!="number"&&i++;else h=e==="desiredWidth"?d.desiredWidth-1:1,(!a[m]||a[m]<h)&&(a[m]=h);if(d[e]>h){let c=0;for(;i>0&&d[e]>h;){if(typeof n[m+c]!="number"){let p=Math.round((d[e]-h)/i);h+=p,o[m+c]+=p,i--}c++}}}Object.assign(n,o,a);for(let s=0;s<n.length;s++)n[s]=Math.max(D,n[s]||0)}}const M=xu,ID=de,Ou=Fe.exports;class Ge extends Array{constructor(e){super();const t=ID.mergeOptions(e);if(Object.defineProperty(this,"options",{value:t,enumerable:t.debug}),t.debug){switch(typeof t.debug){case"boolean":M.setDebugLevel(M.WARN);break;case"number":M.setDebugLevel(t.debug);break;case"string":M.setDebugLevel(parseInt(t.debug,10));break;default:M.setDebugLevel(M.WARN),M.warn(`Debug option is expected to be boolean, number, or string. Received a ${typeof t.debug}`)}Object.defineProperty(this,"messages",{get(){return M.debugMessages()}})}}toString(){let e=this,t=this.options.head&&this.options.head.length;t?(e=[this.options.head],this.length&&e.push.apply(e,this)):this.options.style.head=[];let D=Ou.makeTableLayout(e);D.forEach(function(r){r.forEach(function(o){o.mergeTableOptions(this.options,D)},this)},this),Ou.computeWidths(this.options.colWidths,D),Ou.computeHeights(this.options.rowHeights,D),D.forEach(function(r){r.forEach(function(o){o.init(this.options)},this)},this);let n=[];for(let r=0;r<D.length;r++){let o=D[r],l=this.options.rowHeights[r];(r===0||!this.options.style.compact||r==1&&t)&&Tu(o,"top",n);for(let a=0;a<l;a++)Tu(o,a,n);r+1==D.length&&Tu(o,"bottom",n)}return n.join(`
|
|
68
|
+
`)}get width(){return this.toString().split(`
|
|
69
|
+
`)[0].length}}Ge.reset=()=>M.reset();function Tu(u,e,t){let D=[];u.forEach(function(r){D.push(r.draw(e))});let n=D.join("");n.length&&t.push(n)}var jD=Ge;(function(u){u.exports=jD})(ae);var ND=Vt(ae.exports);const Ru=(...u)=>{const e=new ND({chars:{top:"","top-mid":"","top-left":"","top-right":"",bottom:"","bottom-mid":"","bottom-left":"","bottom-right":"",left:"","left-mid":"",mid:"","mid-mid":"",right:"","right-mid":"",middle:" "},style:{"padding-left":0,"padding-right":0}});return e.push(...u),e},_u=(...u)=>Ru(...u).toString().split(`
|
|
70
|
+
`),WD=u=>Array.isArray(u)?`Array<${ie(u[0])}>`:ie(u),PD=u=>{const e=[];for(const t of u){if(t.type==="block"||!t.type){const D=" ",n=t.body.map(o=>D+o);n.unshift("");const r=n.join(`
|
|
71
|
+
`);e.push(Ru([$.exports.bold(`${t.title}:`)],[r]).toString())}else if(t.type==="inline"){const D=t.items.map(r=>[$.exports.bold(`${r.title}:`),r.body]),n=Ru(...D);e.push(n.toString())}e.push("")}return e.join(`
|
|
72
|
+
`)},Mu=$.exports.yellow("-"),HD="(No description)",GD="Name",YD="Version",zD="Subcommand",UD="Commands",VD="Flags",qD="Description",Ye="Usage",ZD="Examples",ze="Notes",Ue=u=>{process.stdout.write(u)},Ve=(u,e,t)=>{const D=[{title:GD,body:$.exports.red(e._name)},{title:YD,body:$.exports.yellow(e._version)}];t&&D.push({title:zD,body:$.exports.green(`${e._name} ${H(t.name)}`)}),u.push({type:"inline",items:D}),u.push({title:qD,body:[(t==null?void 0:t.description)||e._description]})},qe=(u,e)=>{const t=e.map(([D,n])=>[D,Mu,n]);u.push({title:ZD,body:_u(...t)})},cu=(u,e,t,D)=>{const{cli:n}=e,r=[];Ve(r,n),r.push({title:Ye,body:[$.exports.magenta(`$ ${n._name} ${Ju("command",e.hasRootOrAlias)} [flags]`)]});const o=[...e.hasRoot?[n._commands[w]]:[],...Object.values(n._commands)].map(l=>{const a=[typeof l.name=="symbol"?"":l.name,...zt(l.alias||[])].sort((s,d)=>s===w?-1:d===w?1:s.length-d.length).map(s=>s===""||typeof s=="symbol"?`${n._name}`:`${n._name} ${s}`).join(", ");return[$.exports.cyan(a),Mu,l.description]});return r.push({title:UD,body:_u(...o)}),t&&r.push({title:ze,body:t}),D&&qe(r,D),u(r)},Ze=(u,e,t)=>{var D;const{cli:n}=e,r=du(n._commands,t);if(!r)throw new ou(H(t));const o=[];Ve(o,n,{...r,name:H(t)});const l=((D=r.parameters)==null?void 0:D.join(" "))||void 0,a=` ${H(t)}`,s=l?` ${l}`:"",d=r.flags?" [flags]":"";return o.push({title:Ye,body:[$.exports.magenta(`$ ${n._name}${a}${s}${d}`)]}),r.flags&&o.push({title:VD,body:_u(...Object.entries(r.flags).map(([C,m])=>{const h=[re(C)];m.alias&&h.push(re(m.alias));const i=[$.exports.blue(h.join(", "))];if(i.push(Mu,m.description||HD),m.type){const c=WD(m.type);i.push($.exports.gray(`(${c})`))}return i}))}),r.notes&&o.push({title:ze,body:r.notes}),r.examples&&qe(o,r.examples),u(o)},JD=({command:u=!0,showHelpWhenNoCommand:e=!0,notes:t,examples:D,banner:n,renderer:r="cliffy"}={})=>P({setup:o=>{const l=r==="cliffy"?PD:()=>"",a=s=>{n&&Ue(`${n}
|
|
73
|
+
`),Ue(s)};return u&&(o=o.command("help","Show help",{parameters:["[command...]"],notes:["If no command is specified, show help for the CLI.","If a command is specified, show help for the command.","-h is an alias for --help."],examples:[[`$ ${o._name} help`,"Show help"],[`$ ${o._name} help <command>`,"Show help for a specific command"],[`$ ${o._name} <command> --help`,"Show help for a specific command"]]}).on("help",s=>{s.parameters.command.length?a(Ze(l,s,s.parameters.command)):a(cu(l,s,t,D))})),o.inspector((s,d)=>{const C=s.raw.mergedFlags.h||s.raw.mergedFlags.help;if(!s.hasRootOrAlias&&!s.raw._.length&&e&&!C){let m=`No command given.
|
|
74
|
+
|
|
75
|
+
`;m+=cu(l,s,t,D),m+=`
|
|
76
|
+
`,a(m),process.exit(1)}else C?s.raw._.length?s.called!==w&&s.name===w?a(cu(l,s,t,D)):a(Ze(l,s,s.raw._)):a(cu(l,s,t,D)):d()}),o}}),k=new Uint32Array(65536),KD=(u,e)=>{const t=u.length,D=e.length,n=1<<t-1;let r=-1,o=0,l=t,a=t;for(;a--;)k[u.charCodeAt(a)]|=1<<a;for(a=0;a<D;a++){let s=k[e.charCodeAt(a)];const d=s|o;s|=(s&r)+r^r,o|=~(s|r),r&=s,o&n&&l++,r&n&&l--,o=o<<1|1,r=r<<1|~(d|o),o&=d}for(a=t;a--;)k[u.charCodeAt(a)]=0;return l},QD=(u,e)=>{const t=e.length,D=u.length,n=[],r=[],o=Math.ceil(t/32),l=Math.ceil(D/32);for(let i=0;i<o;i++)r[i]=-1,n[i]=0;let a=0;for(;a<l-1;a++){let i=0,c=-1;const p=a*32,F=Math.min(32,D)+p;for(let f=p;f<F;f++)k[u.charCodeAt(f)]|=1<<f;for(let f=0;f<t;f++){const E=k[e.charCodeAt(f)],g=r[f/32|0]>>>f&1,A=n[f/32|0]>>>f&1,tu=E|i,Du=((E|A)&c)+c^c|E|A;let I=i|~(Du|c),nu=c&Du;I>>>31^g&&(r[f/32|0]^=1<<f),nu>>>31^A&&(n[f/32|0]^=1<<f),I=I<<1|g,nu=nu<<1|A,c=nu|~(tu|I),i=I&tu}for(let f=p;f<F;f++)k[u.charCodeAt(f)]=0}let s=0,d=-1;const C=a*32,m=Math.min(32,D-C)+C;for(let i=C;i<m;i++)k[u.charCodeAt(i)]|=1<<i;let h=D;for(let i=0;i<t;i++){const c=k[e.charCodeAt(i)],p=r[i/32|0]>>>i&1,F=n[i/32|0]>>>i&1,f=c|s,E=((c|F)&d)+d^d|c|F;let g=s|~(E|d),A=d&E;h+=g>>>D-1&1,h-=A>>>D-1&1,g>>>31^p&&(r[i/32|0]^=1<<i),A>>>31^F&&(n[i/32|0]^=1<<i),g=g<<1|p,A=A<<1|F,d=A|~(f|g),s=g&f}for(let i=C;i<m;i++)k[u.charCodeAt(i)]=0;return h},Je=(u,e)=>{if(u.length<e.length){const t=e;e=u,u=t}return e.length===0?u.length:u.length<=32?KD(u,e):QD(u,e)};var hu=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},XD=1/0,un="[object Symbol]",en=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,tn="\\u0300-\\u036f\\ufe20-\\ufe23",Dn="\\u20d0-\\u20f0",nn="["+tn+Dn+"]",rn=RegExp(nn,"g"),on={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},sn=typeof hu=="object"&&hu&&hu.Object===Object&&hu,an=typeof self=="object"&&self&&self.Object===Object&&self,ln=sn||an||Function("return this")();function cn(u){return function(e){return u==null?void 0:u[e]}}var hn=cn(on),pn=Object.prototype,mn=pn.toString,Ke=ln.Symbol,Qe=Ke?Ke.prototype:void 0,Xe=Qe?Qe.toString:void 0;function fn(u){if(typeof u=="string")return u;if(Fn(u))return Xe?Xe.call(u):"";var e=u+"";return e=="0"&&1/u==-XD?"-0":e}function dn(u){return!!u&&typeof u=="object"}function Fn(u){return typeof u=="symbol"||dn(u)&&mn.call(u)==un}function Cn(u){return u==null?"":fn(u)}function gn(u){return u=Cn(u),u&&u.replace(en,hn).replace(rn,"")}var En=gn;let O,T;(function(u){u.ALL_CLOSEST_MATCHES="all-closest-matches",u.ALL_MATCHES="all-matches",u.ALL_SORTED_MATCHES="all-sorted-matches",u.FIRST_CLOSEST_MATCH="first-closest-match",u.FIRST_MATCH="first-match"})(O||(O={})),function(u){u.EDIT_DISTANCE="edit-distance",u.SIMILARITY="similarity"}(T||(T={}));const ut=new Error("unknown returnType"),pu=new Error("unknown thresholdType"),et=(u,e)=>{let t=u;return e.trimSpaces&&(t=t.trim().replace(/\s+/g," ")),e.deburr&&(t=En(t)),e.caseSensitive||(t=t.toLowerCase()),t},tt=(u,e)=>{const{matchPath:t}=e,D=((n,r)=>{const o=r.length>0?r.reduce((l,a)=>l==null?void 0:l[a],n):n;return typeof o!="string"?"":o})(u,t);return et(D,e)};function Bn(u,e,t){const D=(m=>{const h={caseSensitive:!1,deburr:!0,matchPath:[],returnType:O.FIRST_CLOSEST_MATCH,thresholdType:T.SIMILARITY,trimSpaces:!0,...m};switch(h.thresholdType){case T.EDIT_DISTANCE:return{threshold:20,...h};case T.SIMILARITY:return{threshold:.4,...h};default:throw pu}})(t),{returnType:n,threshold:r,thresholdType:o}=D,l=et(u,D);let a,s;switch(o){case T.EDIT_DISTANCE:a=m=>m<=r,s=m=>Je(l,tt(m,D));break;case T.SIMILARITY:a=m=>m>=r,s=m=>((h,i)=>{if(!h||!i)return 0;if(h===i)return 1;const c=Je(h,i),p=Math.max(h.length,i.length);return(p-c)/p})(l,tt(m,D));break;default:throw pu}const d=[],C=e.length;switch(n){case O.ALL_CLOSEST_MATCHES:case O.FIRST_CLOSEST_MATCH:{const m=[];let h;switch(o){case T.EDIT_DISTANCE:h=1/0;for(let c=0;c<C;c+=1){const p=s(e[c]);h>p&&(h=p),m.push(p)}break;case T.SIMILARITY:h=0;for(let c=0;c<C;c+=1){const p=s(e[c]);h<p&&(h=p),m.push(p)}break;default:throw pu}const i=m.length;for(let c=0;c<i;c+=1){const p=m[c];a(p)&&p===h&&d.push(c)}break}case O.ALL_MATCHES:for(let m=0;m<C;m+=1)a(s(e[m]))&&d.push(m);break;case O.ALL_SORTED_MATCHES:{const m=[];for(let h=0;h<C;h+=1){const i=s(e[h]);a(i)&&m.push({score:i,index:h})}switch(o){case T.EDIT_DISTANCE:m.sort((h,i)=>h.score-i.score);break;case T.SIMILARITY:m.sort((h,i)=>i.score-h.score);break;default:throw pu}for(const h of m)d.push(h.index);break}case O.FIRST_MATCH:for(let m=0;m<C;m+=1)if(a(s(e[m]))){d.push(m);break}break;default:throw ut}return((m,h,i)=>{switch(i){case O.ALL_CLOSEST_MATCHES:case O.ALL_MATCHES:case O.ALL_SORTED_MATCHES:return h.map(c=>m[c]);case O.FIRST_CLOSEST_MATCH:case O.FIRST_MATCH:return h.length?m[h[0]]:null;default:throw ut}})(e,d,n)}var V={exports:{}};let xn=mu,bn=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||xn.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),x=(u,e,t=u)=>D=>{let n=""+D,r=n.indexOf(e,u.length);return~r?u+Dt(n,e,t,r)+e:u+n+e},Dt=(u,e,t,D)=>{let n=u.substring(0,D)+t,r=u.substring(D+e.length),o=r.indexOf(e);return~o?n+Dt(r,e,t,o):n+r},nt=(u=bn)=>({isColorSupported:u,reset:u?e=>`\x1B[0m${e}\x1B[0m`:String,bold:u?x("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?x("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?x("\x1B[3m","\x1B[23m"):String,underline:u?x("\x1B[4m","\x1B[24m"):String,inverse:u?x("\x1B[7m","\x1B[27m"):String,hidden:u?x("\x1B[8m","\x1B[28m"):String,strikethrough:u?x("\x1B[9m","\x1B[29m"):String,black:u?x("\x1B[30m","\x1B[39m"):String,red:u?x("\x1B[31m","\x1B[39m"):String,green:u?x("\x1B[32m","\x1B[39m"):String,yellow:u?x("\x1B[33m","\x1B[39m"):String,blue:u?x("\x1B[34m","\x1B[39m"):String,magenta:u?x("\x1B[35m","\x1B[39m"):String,cyan:u?x("\x1B[36m","\x1B[39m"):String,white:u?x("\x1B[37m","\x1B[39m"):String,gray:u?x("\x1B[90m","\x1B[39m"):String,bgBlack:u?x("\x1B[40m","\x1B[49m"):String,bgRed:u?x("\x1B[41m","\x1B[49m"):String,bgGreen:u?x("\x1B[42m","\x1B[49m"):String,bgYellow:u?x("\x1B[43m","\x1B[49m"):String,bgBlue:u?x("\x1B[44m","\x1B[49m"):String,bgMagenta:u?x("\x1B[45m","\x1B[49m"):String,bgCyan:u?x("\x1B[46m","\x1B[49m"):String,bgWhite:u?x("\x1B[47m","\x1B[49m"):String});V.exports=nt(),V.exports.createColors=nt;const An=u=>u.length<=1?u[0]:`${u.slice(0,-1).map(V.exports.bold).join(", ")} and ${V.exports.bold(u[u.length-1])}`,yn=()=>P({setup:u=>u.inspector({enforce:"pre",fn:(e,t)=>{const D=Object.keys(u._commands),n=!!D.length;try{t()}catch(r){if(!(r instanceof ou||r instanceof su))throw r;if(e.raw._.length===0||r instanceof su){console.error("No command given."),n&&console.error(`Possible commands: ${An(D)}.`);return}const o=r.commandName,l=Bn(o,D);console.error(`Command "${V.exports.strikethrough(o)}" not found.`),n&&l?console.error(`Did you mean "${V.exports.bold(l)}"?`):n||console.error("NOTE: You haven't register any command yet."),process.stderr.write(`
|
|
77
|
+
`),process.exit(2)}}})}),wn=u=>u.length<=1?u[0]:`${u.slice(0,-1).join(", ")} and ${u[u.length-1]}`,Sn=()=>P({setup:u=>u.inspector((e,t)=>{const D=Object.keys(e.unknownFlags);if(!e.resolved||D.length===0)t();else throw new Error(`Unexpected flag${D.length>1?"s":""}: ${wn(D)}`)})}),$n=u=>u.length===0?"":u.startsWith("v")?u:`v${u}`,vn=({alias:u=["V"],command:e=!0}={})=>P({setup:t=>{const D=$n(t._version);return e&&(t=t.command("version","Show version",{notes:['The version string begins with a "v".']}).on("version",()=>{process.stdout.write(D)})),t.inspector({enforce:"pre",fn:(n,r)=>{let o=!1;const l=["version",...u];for(const a of Object.keys(n.raw.mergedFlags))if(l.includes(a)){o=!0;break}o?process.stdout.write(D):r()}})}});var L={exports:{}};let On=mu,Tn=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||On.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),b=(u,e,t=u)=>D=>{let n=""+D,r=n.indexOf(e,u.length);return~r?u+rt(n,e,t,r)+e:u+n+e},rt=(u,e,t,D)=>{let n=u.substring(0,D)+t,r=u.substring(D+e.length),o=r.indexOf(e);return~o?n+rt(r,e,t,o):n+r},ot=(u=Tn)=>({isColorSupported:u,reset:u?e=>`\x1B[0m${e}\x1B[0m`:String,bold:u?b("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:u?b("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:u?b("\x1B[3m","\x1B[23m"):String,underline:u?b("\x1B[4m","\x1B[24m"):String,inverse:u?b("\x1B[7m","\x1B[27m"):String,hidden:u?b("\x1B[8m","\x1B[28m"):String,strikethrough:u?b("\x1B[9m","\x1B[29m"):String,black:u?b("\x1B[30m","\x1B[39m"):String,red:u?b("\x1B[31m","\x1B[39m"):String,green:u?b("\x1B[32m","\x1B[39m"):String,yellow:u?b("\x1B[33m","\x1B[39m"):String,blue:u?b("\x1B[34m","\x1B[39m"):String,magenta:u?b("\x1B[35m","\x1B[39m"):String,cyan:u?b("\x1B[36m","\x1B[39m"):String,white:u?b("\x1B[37m","\x1B[39m"):String,gray:u?b("\x1B[90m","\x1B[39m"):String,bgBlack:u?b("\x1B[40m","\x1B[49m"):String,bgRed:u?b("\x1B[41m","\x1B[49m"):String,bgGreen:u?b("\x1B[42m","\x1B[49m"):String,bgYellow:u?b("\x1B[43m","\x1B[49m"):String,bgBlue:u?b("\x1B[44m","\x1B[49m"):String,bgMagenta:u?b("\x1B[45m","\x1B[49m"):String,bgCyan:u?b("\x1B[46m","\x1B[49m"):String,bgWhite:u?b("\x1B[47m","\x1B[49m"):String});L.exports=ot(),L.exports.createColors=ot;function Rn(u){return u.split(`
|
|
78
|
+
`).splice(1).map(e=>e.trim().replace("file://",""))}function _n(u){return`
|
|
79
|
+
${Rn(u).map(e=>` ${e.replace(/^at ([\s\S]+) \((.+)\)/,(t,D,n)=>L.exports.gray(`at ${D} (${L.exports.cyan(n)})`))}`).join(`
|
|
80
|
+
`)}`}function Mn(u){return u.map(e=>typeof(e==null?void 0:e.stack)=="string"?`${e.message}
|
|
81
|
+
${_n(e.stack)}`:e)}function kn(u,e){const t=u.toUpperCase(),D=L.exports[e];return L.exports.bold(L.exports.inverse(D(` ${t} `)))}function uu(u,e,t){const D=L.exports[e],n=t!=null&&t.textColor?L.exports[t.textColor]:D,r=(t==null?void 0:t.target)||console.log;return(...o)=>{const l=Mn(o);r(`${kn(u,e)} ${n(l.join(" "))}
|
|
82
|
+
`)}}uu("log","gray"),uu("info","blue",{target:console.info}),uu("warn","yellow",{target:console.warn}),uu("success","green");const Ln=uu("error","red",{target:console.error}),In=()=>P({setup:u=>u.inspector({enforce:"pre",fn:(e,t)=>{try{t()}catch(D){Ln(D.message),process.exit(1)}}})});export{kt as Clerc,Iu as CommandExistsError,ju as CommandNameConflictError,Wu as DescriptionNotSetError,Hu as InvalidCommandNameError,Nu as NameNotSetError,su as NoCommandGivenError,ou as NoSuchCommandError,w as Root,Pu as VersionNotSetError,Yt as completionsPlugin,qu as compose,jt as defineCommand,Lt as defineHandler,It as defineInspector,P as definePlugin,H as formatCommandName,In as friendlyErrorPlugin,JD as helpPlugin,Zu as isInvalidName,yn as notFoundPlugin,Vu as resolveArgv,du as resolveCommand,Yu as resolveFlattenCommands,Uu as resolveParametersBeforeFlag,_t as resolveRootCommands,zu as resolveSubcommandsByParent,Sn as strictFlagsPlugin,vn as versionPlugin,Ju as withBrackets};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clerc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"author": "Ray <nn_201312@163.com> (https://github.com/so1ve)",
|
|
5
5
|
"description": "Clerc: The full-featured cli framework.",
|
|
6
6
|
"keywords": [
|
|
@@ -27,10 +27,6 @@
|
|
|
27
27
|
".": {
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
29
|
"import": "./dist/index.mjs"
|
|
30
|
-
},
|
|
31
|
-
"./toolkit": {
|
|
32
|
-
"types": "./dist/toolkit.d.ts",
|
|
33
|
-
"import": "./dist/toolkit.mjs"
|
|
34
30
|
}
|
|
35
31
|
},
|
|
36
32
|
"main": "dist/index.js",
|
|
@@ -50,18 +46,17 @@
|
|
|
50
46
|
"publishConfig": {
|
|
51
47
|
"access": "public"
|
|
52
48
|
},
|
|
53
|
-
"
|
|
54
|
-
"@clerc/core": "0.
|
|
55
|
-
"@clerc/plugin-completions": "0.
|
|
56
|
-
"@clerc/plugin-
|
|
57
|
-
"@clerc/plugin-
|
|
58
|
-
"@clerc/plugin-
|
|
59
|
-
"@clerc/plugin-
|
|
60
|
-
"@clerc/plugin-version": "0.
|
|
61
|
-
"@clerc/toolkit": "0.25.0"
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@clerc/core": "0.26.0",
|
|
51
|
+
"@clerc/plugin-completions": "0.26.0",
|
|
52
|
+
"@clerc/plugin-friendly-error": "0.26.0",
|
|
53
|
+
"@clerc/plugin-strict-flags": "0.26.0",
|
|
54
|
+
"@clerc/plugin-help": "0.26.0",
|
|
55
|
+
"@clerc/plugin-not-found": "0.26.0",
|
|
56
|
+
"@clerc/plugin-version": "0.26.0"
|
|
62
57
|
},
|
|
63
58
|
"scripts": {
|
|
64
|
-
"build": "puild",
|
|
59
|
+
"build": "puild --minify",
|
|
65
60
|
"watch": "puild --watch"
|
|
66
61
|
}
|
|
67
62
|
}
|
package/dist/toolkit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@clerc/toolkit';
|
package/dist/toolkit.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@clerc/toolkit';
|
package/dist/toolkit.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@clerc/toolkit';
|