You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Non-generic GetValueForOption does not work with boolean flag #1647
It works if you pass "true", e.g. -b true, or if you use the generic method directly.
I ended up adding this code to work around the issue:
// Here I only know that opt is some Option<>if(opt.GetType()==typeof(Option<>).MakeGenericType(typeof(bool))){res=bindingContext.ParseResult.GetValueForOption((Option<bool>)opt);}
@jonsequitur Had a related question on GetValueForOption...
I have UseExceptionHandler setup to try and catch random errors.
What is need to search for a particular global option and get its value when an exception hits? I've tried a few things, but keeps returning nulls.
Parserparser=newCommandLineBuilder(newMyRootCommand()).UseDefaults().UseExceptionHandler((exception,context)=>{// Need to check and get a value for an optional global option here.}
Activity
fix dotnet#1647
shaggygi commentedon Feb 24, 2022
@jonsequitur Had a related question on GetValueForOption...
I have UseExceptionHandler setup to try and catch random errors.
What is need to search for a particular global option and get its value when an exception hits? I've tried a few things, but keeps returning nulls.
Any help is appreciated.
jonsequitur commentedon Feb 24, 2022
You should be able to use
context.ParseResult.GetValueForOption(theOption).shaggygi commentedon Feb 24, 2022
@jonsequitur Okay. I see what I was doing wrong. As usual, I truly appreciate your help (and this API 😄). Thx
fix dotnet#1647