Skip to content

Allow method _chainOrCall to return the promise result. #1907

@Rmannn

Description

@Rmannn

Hi, I am the developper of a nestjs module using commander nestjs-console
Our module is built to partially wrap your module logic into a nestjs module.

We were extracting response from the command until the new version.

commander.js/lib/command.js

Lines 1301 to 1305 in 4ef19fa

if (this.parent) {
actionResult = this._chainOrCall(actionResult, () => {
this.parent.emit(commandEvent, operands, unknown); // legacy
});
}

As you can see here, actionResult will always returns undefined.

Can we add a line to return the result ?

if (this.parent) { 
   actionResult = this._chainOrCall(actionResult, () => { 
     this.parent.emit(commandEvent, operands, unknown); // legacy 
     // new line to allow us extracting the response
     return actionResult
   }); 
 } 

I could help opening a PR if you want.

Thx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions