Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -1072,16 +1072,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
const subCommand = this._findCommand(commandName);
if (!subCommand) this.help({ error: true });

let hookResult;
hookResult = this._chainOrCallSubCommandHook(hookResult, subCommand, 'preSubcommand');
hookResult = this._chainOrCall(hookResult, () => {
let promiseChain;
promiseChain = this._chainOrCallSubCommandHook(promiseChain, subCommand, 'preSubcommand');
promiseChain = this._chainOrCall(promiseChain, () => {
if (subCommand._executableHandler) {
this._executeSubCommand(subCommand, operands.concat(unknown));
} else {
return subCommand._parseCommand(operands, unknown);
}
});
return hookResult;
return promiseChain;
}

/**
Expand Down Expand Up @@ -1295,16 +1295,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
checkForUnknownOptions();
this._processArguments();

let actionResult;
actionResult = this._chainOrCallHooks(actionResult, 'preAction');
actionResult = this._chainOrCall(actionResult, () => this._actionHandler(this.processedArgs));
let promiseChain;
promiseChain = this._chainOrCallHooks(promiseChain, 'preAction');
promiseChain = this._chainOrCall(promiseChain, () => this._actionHandler(this.processedArgs));
if (this.parent) {
actionResult = this._chainOrCall(actionResult, () => {
promiseChain = this._chainOrCall(promiseChain, () => {
this.parent.emit(commandEvent, operands, unknown); // legacy
});
}
actionResult = this._chainOrCallHooks(actionResult, 'postAction');
return actionResult;
promiseChain = this._chainOrCallHooks(promiseChain, 'postAction');
return promiseChain;
}
if (this.parent && this.parent.listenerCount(commandEvent)) {
checkForUnknownOptions();
Expand Down