using System.CommandLine;
using System.CommandLine.Invocation;
public static void Main(string[] args)
var rootCommand = new RootCommand{new Option<string?>("--myoption", () => null)};
rootCommand.Handler = CommandHandler.Create<string?>(Run);
rootCommand.Invoke(args);
private static void Run(string? myoption)
Console.WriteLine(myoption == null ? "(null)" : '"' + myoption + '"');