HasOption alternative When migrating to 2.0 beta5
When migrating to 2.0 beta 5, the ParseResult.HasOption is not there any more, and seems not mentioned in the migration guide, is there alternative for it?
I use it to see whether the user has that option input
https://learn.microsoft.com/en-us/dotnet/standard/commandline/migration-guide-2.0.0-beta5
Without knowing more about the specific usage, I would generally say use ParseResult.GetValue.
Does this work or is there a reason to have a separate check for HasOption?
In the dotnet SDK we have our own HasOption - we mostly use it to add the extra "is not implicit" check so we can tell when something was explicitly set by the user.
I don't remember if that's what HasOption did before, e.g. did it return true when the default value was used?
I was looking for the ability to differentiate these yesterday though. In the current API you can check ParseResult.GetResult(option).Implicit.
Thanks very much @baronfel @jonsequitur , should I close this one now since it's resolved, or keep it open for document?
Let's keep this open until we make a decision on the documentation bug.
We would want one or two new APIs for this where we clearly answer, "did the user specify this option?" and, "is there a value for this option?"
For 2.0.0, we should augment the API docs to have better clarity around those 2 questions. Then we will explore new APIs in 3.0.0.
Assigning to @adamsitnik for the docs portion.