I am using System.CommandLine
and I wanted to create a mutually exclusive option. The user either has to use --ipAddresses
and pass in list of one or more IP addresses OR use --ipAddressesCsv
and pass in a file path containing the CSV file. I am wondering if its something possible to do with System.CommandLine
.
This is my setup:
var ipAddressesOption = new Option<IEnumerable<IPAddress>>("--ipAddresses")
{
Description = "The IP addresses",
IsRequired = true,
Arity = ArgumentArity.OneOrMore,
AllowMultipleArgumentsPerToken = true,
};
var ipAddressesCsvOption = new Option<FileInfo?>("--ipAddressesCsv")
{
Description = "CSV containing the IP addresses",
IsRequired = true,
Arity = ArgumentArity.ZeroOrOne,
AllowMultipleArgumentsPerToken = false,
};