@gajae-code/utils 0.11.10 → 0.11.11
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/package.json +2 -2
- package/src/cli.ts +11 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@gajae-code/utils",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.11",
|
|
5
5
|
"description": "Shared utilities for pi packages",
|
|
6
6
|
"homepage": "https://gajae-code.com",
|
|
7
7
|
"author": "Yeachan-Heo",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"fmt": "biome format --write ."
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@gajae-code/natives": "0.11.
|
|
34
|
+
"@gajae-code/natives": "0.11.11",
|
|
35
35
|
"beautiful-mermaid": "^1.1.3",
|
|
36
36
|
"handlebars": "^4.7.9",
|
|
37
37
|
"winston": "^3.19.0",
|
package/src/cli.ts
CHANGED
|
@@ -211,8 +211,11 @@ export abstract class Command {
|
|
|
211
211
|
if (raw === undefined || typeof raw === "boolean") {
|
|
212
212
|
flags[name] = desc.default ?? undefined;
|
|
213
213
|
} else {
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
if (typeof raw !== "string" || !/^-?\d+$/.test(raw)) {
|
|
215
|
+
throw new CliParseError(`Expected integer for --${name}, got "${String(raw)}"`);
|
|
216
|
+
}
|
|
217
|
+
const n = Number(raw);
|
|
218
|
+
if (!Number.isSafeInteger(n)) {
|
|
216
219
|
throw new CliParseError(`Expected integer for --${name}, got "${raw}"`);
|
|
217
220
|
}
|
|
218
221
|
flags[name] = n;
|
|
@@ -267,6 +270,12 @@ export abstract class Command {
|
|
|
267
270
|
}
|
|
268
271
|
}
|
|
269
272
|
|
|
273
|
+
if (strict && posIdx < positionals.length) {
|
|
274
|
+
const unexpected = positionals.slice(posIdx);
|
|
275
|
+
const rendered = unexpected.map(value => JSON.stringify(value)).join(", ");
|
|
276
|
+
throw new CliParseError(`Unexpected argument${unexpected.length === 1 ? "" : "s"}: ${rendered}`);
|
|
277
|
+
}
|
|
278
|
+
|
|
270
279
|
return { flags, args, argv: positionals } as never;
|
|
271
280
|
}
|
|
272
281
|
}
|