Closed
Description
Hi,
Consider following code:
program
.command('command <name>')
.option("-a, --action", "Action")
.description('Demo')
.action((name, options) => {
console.log(`name: ${name}`);
console.log(`action: ${options.action}`);
});
When I call it like this: command NAME -a
, the output will be:
name: NAME
action: undefined
But when I call it like this: command NAME -a -a
, the output will be:
name: NAME
action: true
Now if I change .option("-a, --action", "Action")
to .option("-a, --action_", "Action")
and console.log(
action: ${options.action});
to console.log(
action: ${options.action_});
and call it like this command NAME -a
, the output will be:
name: NAME
action: true
Metadata
Assignees
Labels
No labels