-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Hi,
I'm following the pizza example in the documentation
index.js
const { program } = require('commander');
program
.option('-d, --debug', 'output extra debugging')
.option('-s, --small', 'small pizza size')
.option('-p, --pizza-type <type>', 'flavour of pizza');
program.parse(process.argv);
if (program.debug) console.log(program.opts());
console.log('pizza details:');
if (program.small) console.log('- small pizza size');
if (program.pizzaType) console.log(`- ${program.pizzaType}`);
package.json
{
"name": "test",
"scripts": {
"start": "node index.js",
},
"dependencies": {
"commander": "^5.1.0"
}
}
when I'm running yarn start -p cheese everything works as expected and the console prints
pizza details:
- cheese
however when I'm running npm run start -p cheese the pizza type flag is missing, the console prints
pizza details:
Metadata
Metadata
Assignees
Labels
No labels