@trenskow/arguments-parser 0.3.90 → 0.3.91
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 +6 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -50,6 +50,7 @@ const argumentsParser = (
|
|
|
50
50
|
placeholder = '<>',
|
|
51
51
|
command,
|
|
52
52
|
onCommand,
|
|
53
|
+
onParameter,
|
|
53
54
|
strings = {},
|
|
54
55
|
help: {
|
|
55
56
|
usage: helpUsage,
|
|
@@ -153,14 +154,13 @@ const argumentsParser = (
|
|
|
153
154
|
|
|
154
155
|
try {
|
|
155
156
|
|
|
156
|
-
onCommand?.(identifier, args.slice(1));
|
|
157
|
-
|
|
158
157
|
return await command({
|
|
159
158
|
args: args.slice(1),
|
|
160
159
|
argumentsParser: argumentsParser({
|
|
161
160
|
args: args.slice(1),
|
|
162
161
|
argvLevel: argvLevel + 1,
|
|
163
162
|
onCommand,
|
|
163
|
+
onParameter,
|
|
164
164
|
placeholder,
|
|
165
165
|
command: command,
|
|
166
166
|
strings,
|
|
@@ -214,6 +214,8 @@ const argumentsParser = (
|
|
|
214
214
|
.replace('<command>', args[0])));
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
+
onCommand?.(tool, args.slice(1));
|
|
218
|
+
|
|
217
219
|
return await next(
|
|
218
220
|
tool,
|
|
219
221
|
commands[tool]);
|
|
@@ -261,6 +263,8 @@ const argumentsParser = (
|
|
|
261
263
|
printHelp(error);
|
|
262
264
|
}
|
|
263
265
|
|
|
266
|
+
(onParameter || onCommand)?.(identifier, args.slice(1));
|
|
267
|
+
|
|
264
268
|
return await next(
|
|
265
269
|
identifier,
|
|
266
270
|
command);
|