@trenskow/arguments-parser 0.3.92 → 0.3.93
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 +9 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -166,7 +166,8 @@ const argumentsParser = (
|
|
|
166
166
|
strings,
|
|
167
167
|
options,
|
|
168
168
|
parameters
|
|
169
|
-
})
|
|
169
|
+
}),
|
|
170
|
+
parameters
|
|
170
171
|
});
|
|
171
172
|
|
|
172
173
|
} catch (error) {
|
|
@@ -195,7 +196,7 @@ const argumentsParser = (
|
|
|
195
196
|
}${
|
|
196
197
|
Array.isArray(command.parameters) ? ` ${
|
|
197
198
|
command.parameters
|
|
198
|
-
.map((parameter) => `${opening}${parameter}${closing}`)
|
|
199
|
+
.map((parameter) => `${opening}${caseit(parameter, 'kebab')}${closing}`)
|
|
199
200
|
.join(' ')
|
|
200
201
|
}` : ''
|
|
201
202
|
}`,
|
|
@@ -287,8 +288,8 @@ const argumentsParser = (
|
|
|
287
288
|
validationOptions);
|
|
288
289
|
|
|
289
290
|
options.schema = merge(
|
|
290
|
-
|
|
291
|
-
.with(schema);
|
|
291
|
+
schema)
|
|
292
|
+
.with(options.schema);
|
|
292
293
|
|
|
293
294
|
return result;
|
|
294
295
|
|
|
@@ -356,10 +357,11 @@ const argumentsParser = (
|
|
|
356
357
|
const keyPathSchema = keyPaths(options.schema).get(keyPath);
|
|
357
358
|
|
|
358
359
|
let optionKeys = [`--${caseit(keyPath, 'kebab')}`];
|
|
360
|
+
|
|
359
361
|
let description = [keyPathSchema.description || strings?.commands?.help?.noDescription || 'No description'];
|
|
360
362
|
|
|
361
|
-
if (
|
|
362
|
-
optionKeys.push(`-${
|
|
363
|
+
if (keyPathSchema.short) {
|
|
364
|
+
optionKeys.push(`-${keyPathSchema.short}`);
|
|
363
365
|
}
|
|
364
366
|
|
|
365
367
|
if (typeof keyPathSchema.enum !== 'undefined') {
|
|
@@ -494,7 +496,7 @@ const argumentsParser = (
|
|
|
494
496
|
printHelp(error);
|
|
495
497
|
}
|
|
496
498
|
|
|
497
|
-
return Object.assign({},
|
|
499
|
+
return Object.assign({}, data, {
|
|
498
500
|
onError: (error) => {
|
|
499
501
|
print.err(error.message);
|
|
500
502
|
process.exit(1);
|