Skip to content

Support to know if any known command was processed, or any output written #240

@yanickrochon

Description

@yanickrochon

When calling program.parse(process.argv);, I would like to know if any command was processed. Meaning, if the program was invoked with either -h, --help, version or any other command.

For example, if I have this setup

program.command('foo')
 ....
;
program.once('foo', function () { console.log('*** Foo invoked!'); });

program.once('version', function () { console.log('*** Version printed');

this will only output *** Foo invoked! if the command foo is specified in the command-line, but will not output *** Version printed! if version is specified.

Bottom line is that, I'd that, right after program.parse(process.argv);, to know whether anything happened (any output, any command processed, etc.) or not. How can I uniformingly do this?

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