1 | const eachAsync = require('series-async-each');
|
2 | const loadCommand = require('./loadCommand');
|
3 |
|
4 | const executeCommand = async (app, command, executionParams) => {
|
5 |
|
6 | if (command.composedOf) {
|
7 | await eachAsync(command.composedOf, async (subcommandName) => {
|
8 | const subcommand = loadCommand(app, subcommandName);
|
9 | await executeCommand(
|
10 | app,
|
11 | subcommand,
|
12 | Object.assign(executionParams, command.composingParams)
|
13 | );
|
14 | });
|
15 | } else {
|
16 | await command.execute(executionParams);
|
17 | }
|
18 | };
|
19 |
|
20 | module.exports = executeCommand;
|