@trenskow/arguments-parser 0.3.84 → 0.3.86
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/.vscode/settings.json +8 -0
- package/lib/index.js +18 -8
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -114,9 +114,23 @@ const argumentsParser = (
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
if (error) {
|
|
117
|
+
|
|
117
118
|
print();
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
|
|
120
|
+
(error.errors || [error])
|
|
121
|
+
.forEach((error) => {
|
|
122
|
+
|
|
123
|
+
let message = error.message;
|
|
124
|
+
|
|
125
|
+
if (error.keyPath?.[0]) {
|
|
126
|
+
message = `${caseit(error.keyPath[0], 'kebab')}: ${message}`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
print.bold((strings?.commands?.help?.error || 'Error: <message>')
|
|
130
|
+
.replace('<message>', message));
|
|
131
|
+
|
|
132
|
+
});
|
|
133
|
+
|
|
120
134
|
}
|
|
121
135
|
|
|
122
136
|
print();
|
|
@@ -264,7 +278,7 @@ const argumentsParser = (
|
|
|
264
278
|
}
|
|
265
279
|
|
|
266
280
|
if (keyPathSchema.type === Array) {
|
|
267
|
-
description.push(`${strings?.options?.help?.
|
|
281
|
+
description.push(`${strings?.options?.help?.allowsMultiple || '(allows multiple)'}`);
|
|
268
282
|
} else if (keyPathSchema.required === true) {
|
|
269
283
|
description.push(`${strings?.options?.help?.required || '(required)'}`);
|
|
270
284
|
} else if (typeof keyPathSchema.default !== 'undefined') {
|
|
@@ -378,11 +392,7 @@ const argumentsParser = (
|
|
|
378
392
|
aggregatedErrors: 'flatten'
|
|
379
393
|
});
|
|
380
394
|
} catch (error) {
|
|
381
|
-
|
|
382
|
-
if (error.keyPath?.[0]) {
|
|
383
|
-
message = `${caseit(error.keyPath[0], 'kebab')}: ${message}`;
|
|
384
|
-
}
|
|
385
|
-
printHelp(new Error(message));
|
|
395
|
+
printHelp(error);
|
|
386
396
|
}
|
|
387
397
|
|
|
388
398
|
return Object.assign({}, data, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trenskow/arguments-parser",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.86",
|
|
4
4
|
"description": "Yet another arguments parser.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"homepage": "https://github.com/trenskow/arguments-parser#readme",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@trenskow/caseit": "^1.4.24",
|
|
28
|
-
"@trenskow/print": "^0.1.
|
|
29
|
-
"isvalid": "^5.0.
|
|
28
|
+
"@trenskow/print": "^0.1.58",
|
|
29
|
+
"isvalid": "^5.0.5"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@eslint/eslintrc": "^3.3.5",
|