Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Back to shared implementation method for .option and .requiredOption #1363

Merged

Conversation

shadowspawn
Copy link
Collaborator

Pull Request

Problem

Implementing .requiredOption() using .option() was very compact, but having second thoughts. Some drawbacks mainly for subclassing:

  • tricky to modify option creation with chain of methods being called
  • fragile reliance on new option being last in options array
  • calling .addOption without final configuration in the passed option

(Prompted by thinking about how to add an override to add a matching --no option for every boolean option.)

Solution

Just shift the shared code back into ._optionEx like previous pattern, but with the new code.

Much as @abetomo suggested in #1331 (comment) !

@shadowspawn shadowspawn added this to the v7.0.0 milestone Sep 26, 2020
Copy link
Collaborator

@abetomo abetomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Thanks!

@shadowspawn shadowspawn merged commit b4fbe67 into tj:release/7.x Sep 26, 2020
@shadowspawn shadowspawn deleted the feature/refactor-option-common-code branch September 26, 2020 20:12
@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Sep 26, 2020
@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants