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
For args that have skipValidation set to true
, check if the parsed arg is true
#619
Conversation
…arg is `true` When an arg is defined, it will always exist in the parsed argv. Thus, validation would always be skipped, regardless of whether an arg that has `skipValidation` set to `true` is actually passed on the command line. This commit checks to see if the parsed argv value is actually set to true.
@faazshift awesome \o/ mind adding a test for this behavior? otherwise, looks great. |
@bcoe Thanks! A test is now added. |
LGTM 👍 |
@faazshift looks good to me too! one comment though, noticing |
@bcoe This should already be in the docs. Specifically, in the opts section here: https://github.com/yargs/yargs/blob/master/README.md#optionskey-opt |
@faazshift looks good to me, don't know how I missed that. |
@faazshift mind giving this a spin:
Your work will go out with the next release 👍 |
@bcoe In doing some testing yesterday, my use-case now works as expected. However after some more extensive testing, I realized that more extensive fixes needed to be made to make things actually work how they are supposed to. Specifically, I needed to make some changes to yargs/yargs-parser to support some more changes here. I will open a new PR on both repos with my proposed changes. Update: New PRs are #645 and yargs/yargs-parser#60 |
Hey @faazshift mind providing an example of some of the edge-cases you're thinking of? I think we might be able to avoid the changes to
|
@bcoe The problem exists in the fact that the data returned from Not sure if all that made sense, but that's why I made the changes I did in my PR for |
When an arg is defined, it will always exist in the parsed argv. Thus, validation would always be skipped, regardless of whether an arg that has
skipValidation
set totrue
is actually passed on the command line. This commit checks to see if the parsed argv value is actually set to true.