trm-client 7.0.2 → 7.0.3

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/changelog.txt CHANGED
@@ -8,6 +8,10 @@ Legend
8
8
  + : added
9
9
  - : removed
10
10
 
11
+ 2025-11-10 v7.0.3
12
+ -------------------
13
+ * commands with 2+ arguments
14
+
11
15
  2025-11-07 v7.0.2
12
16
  -------------------
13
17
  * deprecate typo
@@ -209,28 +209,16 @@ class AbstractCommand {
209
209
  default: throw new Error(`Unknown inquirer type "${type}". Possible values are ${Object.keys(InquirerType_1.InquirerType).map(k => InquirerType_1.InquirerType[k]).join(', ')}.`);
210
210
  }
211
211
  }
212
- parseCommandArgs(args1, args2) {
213
- var args = this.command['_optionValues'] || {};
214
- if (!args1) {
215
- args1 = {};
216
- }
217
- if (!args2) {
218
- args2 = {};
219
- }
220
- if (typeof (args1) === 'string') {
221
- const oArg1 = this.command["_args"][0];
222
- args[oArg1.name()] = args1;
223
- if (typeof (args2) === 'string') {
224
- const oArg2 = this.command["_args"][1];
225
- args[oArg2.name()] = args2;
226
- }
227
- else {
228
- args = Object.assign(Object.assign({}, args), args2);
212
+ parseCommandArgs(argsValues) {
213
+ var args = {};
214
+ const commandOpts = this.command['_optionValues'] || {};
215
+ const commandArgs = this.command["_args"] || [];
216
+ commandArgs.forEach((a, i) => {
217
+ if (typeof (argsValues[i]) === 'string') {
218
+ args[a.name()] = argsValues[i];
229
219
  }
230
- }
231
- else {
232
- args = Object.assign(Object.assign({}, args), args1);
233
- }
220
+ });
221
+ args = Object.assign(Object.assign({}, commandOpts), args);
234
222
  args = Object.entries(args).reduce((acc, [key, value]) => {
235
223
  const newKey = key.includes(" ") ? key.replace(/ (\w)/g, (_, char) => char.toUpperCase()) : key;
236
224
  acc[newKey] = value;
@@ -304,9 +292,9 @@ class AbstractCommand {
304
292
  catch (_a) { }
305
293
  }
306
294
  }
307
- execute(args1, args2) {
295
+ execute(...args) {
308
296
  return __awaiter(this, void 0, void 0, function* () {
309
- this.args = this.parseCommandArgs(args1, args2);
297
+ this.args = this.parseCommandArgs(args);
310
298
  this.onArgs();
311
299
  var exitCode;
312
300
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trm-client",
3
- "version": "7.0.2",
3
+ "version": "7.0.3",
4
4
  "description": "TRM (Transport Request Manager) Client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",