@trenskow/arguments-parser 0.2.4 → 0.2.6
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 +17 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -173,6 +173,21 @@ const argumentsParser = ({ args = process.argv.slice(2), argvLevel = 0, placehol
|
|
|
173
173
|
|
|
174
174
|
print();
|
|
175
175
|
|
|
176
|
+
if (error) {
|
|
177
|
+
|
|
178
|
+
(error.errors || [error])
|
|
179
|
+
.forEach((error) => {
|
|
180
|
+
if (error.keyPath) {
|
|
181
|
+
print.err(`--${caseit(error.keyPath.join('.'), 'kebab')}: ${error.message}`);
|
|
182
|
+
} else {
|
|
183
|
+
print.err(error.message);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
print();
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
176
191
|
process.exit(error ? 1 : 0);
|
|
177
192
|
|
|
178
193
|
};
|
|
@@ -220,10 +235,10 @@ const argumentsParser = ({ args = process.argv.slice(2), argvLevel = 0, placehol
|
|
|
220
235
|
|
|
221
236
|
try {
|
|
222
237
|
data = await isvalid(data, schema, {
|
|
223
|
-
|
|
238
|
+
aggregatedErrors: 'flatten'
|
|
224
239
|
});
|
|
225
240
|
} catch (error) {
|
|
226
|
-
printHelp(
|
|
241
|
+
printHelp(error);
|
|
227
242
|
}
|
|
228
243
|
|
|
229
244
|
return Object.assign({}, data, {
|