introduce ParseResult.GetValue<T>(string name)#2070
introduce ParseResult.GetValue<T>(string name)#2070adamsitnik wants to merge 8 commits intodotnet:mainfrom
Conversation
…nt and Option: * both always have Name specified, so first column can't contain enum values for Arguments with no name anymore * move enum values to second column, but only for symbols with no description
|
@Keboo @jonsequitur @KalleOlaviNiemitalo while working on the new API I've reused some of the tests provided for The existing method throws command-line-api/src/System.CommandLine.Tests/Binding/TypeConversionTests.cs Lines 914 to 923 in 1e15ab1 but it does not throw for command-line-api/src/System.CommandLine/Parsing/SymbolResult.cs Lines 64 to 73 in 1e15ab1 In my opinion both But I am not sure about what should happen when there was an error unrelated to given symbol/name. Should we just throw if there were any parse errors? Please share your thoughts. |
This is by design, if I'm understanding correctly. Here's the logic, and please let me know if I'm misunderstanding. The default value provides a value that can be retrieved via But if the user provided unparseable input (e.g. "hello" for an
I don't think we should throw. I think this would make some scenarios unreachable. For example, custom parse delegates can use |
It's just a draft, as it contains #2067 and I need to ask some questions before I continue my work
fixes #2052