Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

POLL: API for mandatory options #1038

Closed
shadowspawn opened this issue Sep 8, 2019 · 5 comments
Closed

POLL: API for mandatory options #1038

shadowspawn opened this issue Sep 8, 2019 · 5 comments

Comments

@shadowspawn
Copy link
Collaborator

shadowspawn commented Sep 8, 2019

The most upvoted and second oldest open issue is #230 to add support for mandatory options which must be specified on the command line.

(This is in addition to the existing support for options with a required value when the option is specified.)

There have been a number of possible forms for the API proposed. Which one would you like to see implemented? You can vote 👍 for more than one, and can vote 👎 against any you dislike.

@shadowspawn
Copy link
Collaborator Author

shadowspawn commented Sep 8, 2019

.requiredOption

program.requiredOption('-f,--foo <value>', 'foo must be supplied');

@shadowspawn
Copy link
Collaborator Author

shadowspawn commented Sep 8, 2019

.optionEx

program.optionEx('-f,--foo <value>', 'foo must be supplied', { required: true });

@shadowspawn
Copy link
Collaborator Author

shadowspawn commented Sep 8, 2019

.option with *

program.option('-f,--foo* ', 'foo must be supplied');

@shadowspawn shadowspawn pinned this issue Sep 8, 2019
@shadowspawn shadowspawn changed the title POLL: api for mandatory options POLL: API for mandatory options Sep 8, 2019
@shadowspawn shadowspawn unpinned this issue Oct 5, 2019
@shadowspawn
Copy link
Collaborator Author

Thanks for the feedback. Implementing .requiredOption() in #1071.

@shadowspawn
Copy link
Collaborator Author

Added .requiredOption() to v4.0.0 prerelease: #1067

Repository owner locked as resolved and limited conversation to collaborators Jan 5, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant