241
}
242
runCommand(
244
>
yargs: YargsInstance,
245
>
parsed: DetailedArguments,
246
>
commandIndex: number,
247
>
helpOnly: boolean,
248
>
helpOrVersionSet: boolean
249
>
): Arguments | Promise<Arguments> {
250
>
const commandHandler =
251
>
this.handlers[command!] ||
252
>
this.handlers[this.aliasMap[command!]] ||
253
>
this.defaultCommand;
254
>
const currentContext = yargs.getInternalMethods().getContext();
255
>
const parentCommands = currentContext.commands.slice();
256
>
const isDefaultCommand = !command;
257
>
if (command) {
258
currentContext.commands.push(command);
259
currentContext.fullCommands.push(commandHandler.original);
260
}
261
>
const builderResult = this.applyBuilderUpdateUsageAndParse(
command.ts
262
>
isDefaultCommand,
263
>
commandHandler,
264
>
yargs,
265
>
parsed.aliases,
266
>
parentCommands,
267
>
commandIndex,
268
>
helpOnly,
269
>
helpOrVersionSet
270
>
);
271
>
return isPromise(builderResult)
272
>
? builderResult.then(result =>
273
this.applyMiddlewareAndGetResult(
274
isDefaultCommand,