-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
When a option --name is not set on CLI, initial value is a [Function]
Example:
var Command = require('commander').Command;
var program = new Command('my-cli');
program
.version('0.0.1')
.option('--name <name>', 'Set name')
.option('--name-prefix <name>', 'Set prefix name')
.parse(process.argv);
})
...
console.log('name: ' , program.name)
console.log('namePrefix: ', program.namePrefix)The ouput of $ my-cli --name-prefix=test is:
name: [Function]
namePrefix: test
Here
nameshould beundefined
The ouput of $ my-cli --name=test is:
name: test
namePrefix: undefined
Here is ok!
IMHO a widely use option like '--name' that collide with [Command.name] should have a dedicated check and initialization branch in code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels