You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to have one option required. Once I added one, the help message will no longer show unless you include the required option. I would have expected it to show the help.
I created some sample code, from one of your samples.
Test Code:
const commander = require("commander");
const program = new commander.Command();
program
.option("-d, --debug", "output extra debugging")
.requiredOption("-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}`);
I consulted an old PR for the implementation pattern,and I thought it was a bit easy at the time! I have been untangling the command processing today and think I see a solid approach. Trying code now.
Hi,
I wanted to have one option required. Once I added one, the help message will no longer show unless you include the required option. I would have expected it to show the help.
I created some sample code, from one of your samples.
Test Code:
Output:
If I remove the requiredOption I get the expected output:
The text was updated successfully, but these errors were encountered: