CSharp · Console
using System;
using CommandLine;
public class Program
{
public static void Main(string[] args)
{
Parser.Default.ParseArguments<NewOptions>(args).MapResult((NewOptions opts) => NewCommandHandler(opts), errs => 1);
}
private static int NewCommandHandler(NewOptions options)
{
return 0;
}
}
public class NewOptions
{
[Option(longName: "list", Required = true, SetName = "List")]
public bool List { get; set; }
[Option('t', "template", SetName = "Create", Required = false, Default = "default")]
public string TemplateCode { get; set; } = "default";
}