@zoodogood/utils 3.0.0-change.2568 → 4.0.0-change.2617
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.
|
@@ -44,7 +44,7 @@ export function CreateModal({ title, customId, components }: {
|
|
|
44
44
|
title: any;
|
|
45
45
|
customId: any;
|
|
46
46
|
components: any;
|
|
47
|
-
}): import("discord.
|
|
47
|
+
}): import(".pnpm/discord-api-types@0.37.97/node_modules/discord-api-types/v10").APIModalInteractionResponseCallbackData;
|
|
48
48
|
export function SimplifyComponents(data: any): any;
|
|
49
49
|
/**
|
|
50
50
|
*
|
|
@@ -86,7 +86,7 @@ export declare class CliParser {
|
|
|
86
86
|
}): this;
|
|
87
87
|
replaceByMatch(regex: RegExp): RegExpMatchArray | null;
|
|
88
88
|
captureByMatch({ regex, name }: ITextMatch): this;
|
|
89
|
-
|
|
89
|
+
replaceSlice(start: number, length: number, replacer: (string: string) => string): void;
|
|
90
90
|
collect(): CliParserRunContext;
|
|
91
91
|
static CliParserRunContext: typeof CliParserRunContext;
|
|
92
92
|
static CapturedContent: typeof CapturedContent;
|
|
@@ -46,7 +46,7 @@ export class FlagsManager {
|
|
|
46
46
|
captureResidueFlags(context) {
|
|
47
47
|
let match;
|
|
48
48
|
const { parser } = context;
|
|
49
|
-
while ((match = parser.replaceByMatch(
|
|
49
|
+
while ((match = parser.replaceByMatch(/(?<flag>-{1,2}\w+)(?:(?<separator>\s+(?!-)|=)(?<value>\S+))?/))) {
|
|
50
50
|
this.unhandledFlags || (this.unhandledFlags = []);
|
|
51
51
|
this.unhandledFlags.push(match);
|
|
52
52
|
}
|
|
@@ -55,7 +55,7 @@ export class FlagsManager {
|
|
|
55
55
|
captureFlags(flags, context) {
|
|
56
56
|
for (const { name, capture, expectValue } of flags) {
|
|
57
57
|
for (const flag of capture) {
|
|
58
|
-
const regex = `(?<=^|\\s)
|
|
58
|
+
const regex = `(?<=^|\\s)(?<flag>${flag})${expectValue ? "(?:(?<separator>\\s+(?!-)|=)(?<value>[^\\s]+))?" : ""}`;
|
|
59
59
|
const { parser } = context;
|
|
60
60
|
const captureName = name || flag;
|
|
61
61
|
const match = parser.replaceByMatch(RegExp(regex, "i"));
|
|
@@ -109,8 +109,8 @@ export class CapturedContent {
|
|
|
109
109
|
}
|
|
110
110
|
static contentIsRegExpMatchArray(content) {
|
|
111
111
|
return (content instanceof Array &&
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
content.hasOwnProperty("index") &&
|
|
113
|
+
content.hasOwnProperty("input"));
|
|
114
114
|
}
|
|
115
115
|
static contentIsString(content) {
|
|
116
116
|
return typeof content === "string";
|
|
@@ -196,7 +196,7 @@ export class CliParser {
|
|
|
196
196
|
const group = groups[index];
|
|
197
197
|
const replacement = context.brackets.toStringGroup(indexes[index]);
|
|
198
198
|
const length = group.length;
|
|
199
|
-
this.
|
|
199
|
+
this.replaceSlice(group.indexInText - offset, length, () => replacement);
|
|
200
200
|
offset += length - replacement.length;
|
|
201
201
|
}
|
|
202
202
|
return this;
|
|
@@ -218,9 +218,14 @@ export class CliParser {
|
|
|
218
218
|
}
|
|
219
219
|
captureResidue({ name }) {
|
|
220
220
|
const { context } = this;
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
const raw = context.input;
|
|
222
|
+
const value = (() => {
|
|
223
|
+
const stop_hyphen = /^\s+-\s+/;
|
|
224
|
+
const clean = raw.replace(stop_hyphen, "").trim();
|
|
225
|
+
return clean;
|
|
226
|
+
})();
|
|
227
|
+
this.replaceSlice(0, raw.length, () => "");
|
|
228
|
+
context.captures.set(name, new CapturedContent(value).setContextInstance(context));
|
|
224
229
|
return this;
|
|
225
230
|
}
|
|
226
231
|
replaceByMatch(regex) {
|
|
@@ -233,7 +238,7 @@ export class CliParser {
|
|
|
233
238
|
if (indexInText === undefined) {
|
|
234
239
|
throw new Error("Match without index");
|
|
235
240
|
}
|
|
236
|
-
this.
|
|
241
|
+
this.replaceSlice(indexInText, full.length, () => "");
|
|
237
242
|
return matched;
|
|
238
243
|
}
|
|
239
244
|
captureByMatch({ regex, name }) {
|
|
@@ -242,7 +247,7 @@ export class CliParser {
|
|
|
242
247
|
context.captures.set(name, matched ? new CapturedContent(matched).setContextInstance(context) : null);
|
|
243
248
|
return this;
|
|
244
249
|
}
|
|
245
|
-
|
|
250
|
+
replaceSlice(start, length, replacer) {
|
|
246
251
|
const { context } = this;
|
|
247
252
|
const before = context.input.slice(0, start);
|
|
248
253
|
const after = context.input.slice(start + length);
|