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?
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,versionor any other command.For example, if I have this setup
this will only output
*** Foo invoked!if the commandfoois specified in the command-line, but will not output*** Version printed!ifversionis 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?