-
Notifications
You must be signed in to change notification settings - Fork 480
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
.MapResultAsync not working #809
Comments
Nope, it does not (unless you somehow find some hidden or abandoned source code file that declares this method ¯\(ツ)/¯ ).
Do you mean you want to pass the ParserResult produced by var parser = new Parser(c => c.HelpWriter = null);
var parseResult = parser.ParseArguments<AddOptions, CommitOptions, CloneOptions>(args);
parseResult.MapResult(
(AddOptions opts) => RunAddAndReturnExitCodeAsync(opts),
(CommitOptions opts) => RunCommitAndReturnExitCodeAsync(opts),
(CloneOptions opts) => RunCloneAndReturnExitCodeAsync(opts),
errs => Console.WriteLine(DisplayHelp(parseResult))
); (P.S.: Your variable name is utterly confusing and misplaced here: |
@elgonzo Program.DisplayHelp needs to have a (ParserResult). I will look at the code with a professional C# Coder as well so he can help me if possible if I do not get the answer from here. |
If DisplayHelp needs a ParserResult<T> instance, don't pass a Parser instance to it -- pass the ParserResult to it. Pay attention to the P.S. in my last post underneath my code example. In my code example i did change the variable name regarding the parser to make the code less confusing.
How did you come to that conclusion? How could Main and DisplayHelp being async possibly explain why your code is passing a Parser instead of a ParserResult<T> instance? That doesn't make any sense. |
Using the Pull from #390 I get an error when trying to use .MapResultAsync it does not exist in version 2.9.0preview1???
Changing it to MapResult makes the code work. But is Async not implemented correctly?
Furthermore, I want to implement the custom help screen into the mapped results. I do need to change the Parser.Default for this. I have looked at the examples, but I couldn't get it to work.
Question: What do I need to change at
errs => Console.WriteLine(DisplayHelp()));
in order to make it work?The text was updated successfully, but these errors were encountered: