* @private
(commandName, operands, unknown)
| 1362 | */ |
| 1363 | |
| 1364 | _dispatchSubcommand(commandName, operands, unknown) { |
| 1365 | const subCommand = this._findCommand(commandName); |
| 1366 | if (!subCommand) this.help({ error: true }); |
| 1367 | |
| 1368 | subCommand._prepareForParse(); |
| 1369 | let promiseChain; |
| 1370 | promiseChain = this._chainOrCallSubCommandHook( |
| 1371 | promiseChain, |
| 1372 | subCommand, |
| 1373 | 'preSubcommand', |
| 1374 | ); |
| 1375 | promiseChain = this._chainOrCall(promiseChain, () => { |
| 1376 | if (subCommand._executableHandler) { |
| 1377 | this._executeSubCommand(subCommand, operands.concat(unknown)); |
| 1378 | } else { |
| 1379 | return subCommand._parseCommand(operands, unknown); |
| 1380 | } |
| 1381 | }); |
| 1382 | return promiseChain; |
| 1383 | } |
| 1384 | |
| 1385 | /** |
| 1386 | * Invoke help directly if possible, or dispatch if necessary. |
no test coverage detected