-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Current Behavior
program
.addOption(new Option('-p, --port <number>', 'port number').makeOptionMandatory())
.addOption(new Option('--disable-server', 'disables the server').conflicts('port'))
In the above example, if both --port and --disable-server are provided, it shows conflicting error as expected. However, if only --disable-server is provided, it throws an error that says --port was not specified.
program
.addOption(new Option('-p, --port <number>', 'port number'))
.addOption(new Option('--disable-server', 'disables the server').conflicts('port'))
If --port is not marked as mandatory, the program runs if neither option is provided.
Desired Behavior
A way to specify either of two conflicting options as mandatory. In the above example, --port should be mandatory only if --disable-server is not provided.
- If both
--portand--disable-serverare provided, it should show conflicting error as expected. - If only
--disable-serveris provided, it should not throw any error. - If only
--portis provided, it should not throw any error. - If neither option is provided, it should throw an error that says
--portwas not specified.
Reactions are currently unavailable