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
name
should 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.
Metadata
Assignees
Labels
No labels