-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Regression between v1.16 and v1.17 when no command are passed and '*' is registered #843
Copy link
Copy link
Closed
Labels
bugCommander is not working as intendedCommander is not working as intended
Description
There is a regression in the version v1.17
See this sample:
var program = require("commander");
program
.version("0.0.1")
.command("*")
.description("test")
.action(function(cmd) {
cmdValue = cmd;
});
program.parse(process.argv);
if (typeof cmdValue === "undefined") {
console.error("no command given!");
} else {
console.log("command:", cmdValue);
}v1.16
$ node test.js
no command given!v1.17
$ node test.js
command: Command {
commands: [],
options: [],
_execs: {},
_allowUnknownOption: false,
_args: [],
_name: '*',
_noHelp: false,
parent:
Command {
commands: [ [Circular] ],
options: [ [Object] ],
_execs: {},
_allowUnknownOption: false,
_args: [],
_name: 'test',
Command: { [Function: Command] super_: [Object] },
Option: [Function: Option],
_version: '0.0.1',
_versionOptionName: 'version',
_events:
{ 'option:version': [Function],
'command:*': [Function: listener] },
_eventsCount: 2,
rawArgs:
[ 'C:\\Program Files\\nodejs\\node.exe',
'C:\\Users\\schroeterm\\Desktop\\test\\test.js' ],
args: [] },
_description: 'test',
_argsDescription: undefined }Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugCommander is not working as intendedCommander is not working as intended