Skip to content

Allow command builder to accept a promise #1042

@quilicicf

Description

@quilicicf

Feature request

Allow the command builder to accept a promise like follows:

yargs.command('command', 'Does foo', async function() { ... })

This feature is the same as the one from #510 but for the command builder.

Note: in #510, the example shows the async function as 3rd parameter, it should be as 4th because the 3rd is actually the command builder and not the command handler. I'll update this note when the comment is fixed.

Use case

The defaults of a command's parameter depend on the configuration of the app.
In some cases the configuration is not defined => the app prompts the user and helps him bootstrap the configuration then runs the initial command.
The command builder needs to be async.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions