Made boolean CLI option values optional#446
Merged
Conversation
tomblind
reviewed
Feb 23, 2019
|
|
||
| if (option.type === "boolean" && (argument === undefined || argument.startsWith("-"))) { | ||
| // Set boolean arguments without supplied value to true | ||
| return { isValid: true, result: true, increment: 0 }; |
Collaborator
There was a problem hiding this comment.
Would it be better for result to be option.default here (in case a flag option is added that defaults to true if not specified)?
Member
Author
There was a problem hiding this comment.
I guess it should be !option.default? Otherwise setting the option without value would be the same as not setting it at all. I'm a little concerned that's just confusing. Would it ever make sense to have an option that is true by default and can be set to false by just adding its name to CLI? I'm not sure that is a valid use case.
Collaborator
There was a problem hiding this comment.
Yeah, actually you're probably right. If you set a flag up like that, it could just be inverted.
tomblind
approved these changes
Feb 23, 2019
hazzard993
pushed a commit
to hazzard993/TypescriptToLua
that referenced
this pull request
Feb 26, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If no value is supplied, the value defaults to true.