@trenskow/arguments-parser 0.2.21 → 0.3.1
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/lib/index.js +29 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -321,6 +321,21 @@ const argumentsParser = (
|
|
|
321
321
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
+
if (rest.length) {
|
|
325
|
+
switch (options.variadic || 'deny') {
|
|
326
|
+
case 'allow':
|
|
327
|
+
break;
|
|
328
|
+
case 'ignore':
|
|
329
|
+
rest = [];
|
|
330
|
+
break;
|
|
331
|
+
default:
|
|
332
|
+
printHelp(
|
|
333
|
+
new Error(
|
|
334
|
+
(strings?.empty?.help?.errors?.unexpected || 'Unexpected argument: <argument>.')
|
|
335
|
+
.replace('<argument>', args[0])));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
324
339
|
try {
|
|
325
340
|
data = await isvalid(data, schema, {
|
|
326
341
|
aggregatedErrors: 'flatten'
|
|
@@ -338,10 +353,22 @@ const argumentsParser = (
|
|
|
338
353
|
print.err(error.message);
|
|
339
354
|
process.exit(1);
|
|
340
355
|
},
|
|
341
|
-
|
|
342
|
-
|
|
356
|
+
rest,
|
|
357
|
+
nonOptions
|
|
343
358
|
});
|
|
344
359
|
|
|
360
|
+
},
|
|
361
|
+
empty: async () => {
|
|
362
|
+
|
|
363
|
+
checkHelp();
|
|
364
|
+
|
|
365
|
+
if (args.length > 0) {
|
|
366
|
+
printHelp(
|
|
367
|
+
new Error(
|
|
368
|
+
(strings?.empty?.help?.errors?.unexpected || 'Unexpected argument: <argument>.')
|
|
369
|
+
.replace('<argument>', args[0])));
|
|
370
|
+
}
|
|
371
|
+
|
|
345
372
|
},
|
|
346
373
|
values: async (schema) => {
|
|
347
374
|
|