I'd like to define an enum as CLI option in C# System.CommandLine.DragonFruit. Is there "builtin" support for this use case? In detail I need an equivalent to Python's click
implementation of this:
@click.option('-m', '--mode', required=True, type=click.Choice(['SIM_MRM', 'SPECTRUM'], case_sensitive=True), help="The measurement mode.")
If I define the following in the C# console app
using System;
namespace EndDeviceAgent
{
class Program
{
enum MeasurementMode : short
{
SIM_MRM,
SPECTRUM
}
/// <param name="mode">The measurement mode.</param>
static void Main(MeasurementMode mode)
{
Console.WriteLine($"Mode: {mode}");
}
}
}
I get Mode: SIM_MRM
as output. However instead I'd like to get an exception cause the option is required and I don't want the default implied by the enum.