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 +4 -0
- package/dist/command/AbstractCommand.js +11 -23
- package/package.json +1 -1
package/changelog.txt
CHANGED
|
@@ -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(
|
|
213
|
-
var args =
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
-
|
|
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(
|
|
295
|
+
execute(...args) {
|
|
308
296
|
return __awaiter(this, void 0, void 0, function* () {
|
|
309
|
-
this.args = this.parseCommandArgs(
|
|
297
|
+
this.args = this.parseCommandArgs(args);
|
|
310
298
|
this.onArgs();
|
|
311
299
|
var exitCode;
|
|
312
300
|
try {
|