Reputation: 4929
Using the CommandLineParser NuGet, when I run my application with an option like this.
myapplication.exe --searchfolder "c:\my great path\"
How can I use that options more than once? For example, if I want to pass in two folders...
Currently, I use it like this for the single path given...
if (options.Verbose)
{
m_Verbose = true;
Console.WriteLine("Verbose mode on.");
}
if (options.SearchFolder != null && options.SearchFolder != "")
{
Console.WriteLine("Searching folder '{0}'...", options.SearchFolder);
}
Upvotes: 2
Views: 665
Reputation: 26352
You might want to use something like this:
class Options
{
[Option('r', "read", Required = true, HelpText = "Input files to be processed.")]
public IEnumerable<string> InputFiles { get; set; }
Check the official net fiddle here: https://dotnetfiddle.net/wrcAxr for the IEnumerable
usage.
Upvotes: 2