I'm trying to get a list of enums as an option.
[OptionList('m', "modules", HelpText = "List of modules you are going to install or uninstall.")]
public List<RegistrationType> Modules { get; set; }
Unfortunately it expects it to be a list of strings. Any idea on how to make it work as documentation of the lib is a bit short.
Thanks
As of Nov 2018, there is a support for IEnumerable<TEnum>
(package version 2.3.0):
[Option('m', "modules", Separator = ',', HelpText = "List of modules...")]
public IEnumerable<RegistrationType> Modules { get; set; }
Sample parse (has changed since the question was asked):
static void Main(string[] args)
{
Parser.Default.ParseArguments<Options>(args)
.WithParsed(options => ...)
}
Sample command line:
myProject.exe -m RegistrationType1,RegistrationType2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With