-
Notifications
You must be signed in to change notification settings - Fork 9
Add Choices Option #172
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
Comments
At the moment it is not possible. However I feel like you could get very close using Example: public enum TestEnum
{
Value1,
Value2,
Value3,
}
public class Options
{
public TestEnum MyEnum { get; set; }
}
parser.Configure(opt => opt.MyEnum)
.Name("e");
Another way to achieve this without enums would be to use FluentValidations Extension. |
Thank you for the response. Yeah Enum is good idea I'll do it instead. |
Thank you that solved my problem. However there's just little problem when I set the default and input invalid value, It's not throwing the exception but still getting the default value only. But it's ok I just skip the default value |
I do like the choices idea. API could look something like this: IOptionsBuilder<T> Choices(IEnumerable<T> choices);
parser.Configure(opt => opt.SomeOption)
.Choices(new []{ 1, 2, 3 }); Not sure how this would work when the option type is a |
I can't seem find any in the documentation about choices option.
Like in python there is choices option in the argument. Is it possible to do with this great extension?
The text was updated successfully, but these errors were encountered: