-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
One of my command line flags is called '--name', but as of bfa7a73, if the name option is left off, cmd.name is a function. I suppose this is indicative of a larger problem, i.e., options are stored on top-level namespace of the command object.
e.g., say you have this file, mycmd.js
var prog = require('commander');
var command = prog
.command('mycmd')
.option('-n, --name [name]', 'specify a name (duh)')
.action(function(cmd){
console.log(cmd.name);
});
prog.parse(process.argv);you will see the following output:
$ node mycmd.js mycmd
[Function]
$ node mycmd.js mycmd --name Cameron
Cameron
Thoughts?
Is this wrong, or am I missing something?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels