-
-
Notifications
You must be signed in to change notification settings - Fork 261
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
Options not set when OnValidate is called #79
Comments
OK, what I have done for now is to access the My goal is to ensure that the user either passes a value via the option, or alternatively specify a value using an environment variable. This is what I ended up with:
|
I'll be trying to solve this today in #76 |
So, my current thinking is that we should add another callback that executes before line 47.
The conventions for OptionAttribute and ArgumentAttribute can change to use this instead of |
Sounds good. I was wondering if we could just move validation to after parsing has completed? |
Yeah, that is probably better. In fact, the more I think about this, the more I realize there isn't really a good reason for the |
This property had side-effects that changed the order in which validation was called. The recommended replacement is ParseResult.SelectedCommand.GetValidationResult(), and it should be called after OnParsingComplete handlers are finished.
Fixed in 2.2.1 which is now on nuget.org |
Given the following command:
The value for the
Token
property is not set whenOnValidate
is called, but it is set by the timeOnExecuteAsync
is called.Is this by design? If so, what is the correct way to validate options in the
OnValidate
method?The text was updated successfully, but these errors were encountered: