==Console==
===コマンドラインオプションの解析===
* https://docs.microsoft.com/ja-jp/archive/msdn-magazine/2019/march/net-parse-the-command-line-with-system-commandline
* https://blog.yucchiy.com/2021/03/intro-system-commandline/
static int Main(string[] args)
{
// Create a root command with some options var RootCommand rootCommand = new RootCommand {( new Argument<string>( "required", description: "Required ArgumentSimple"), new Option<bool>( "--bool-option", "An option whose argument is parsed as a bool"), new Option<FileInfo>( "--file-option", "An option whose argument is parsed as a FileInfo") };
rootCommand.Description SetHandler(()= >{ Console.WriteLine("My sample appTEST"); });
// Note that the parameters of the handler method are matched according to the names of the options rootCommand.SetHandler<int, bool, FileInfo>((intOption, boolOption, fileOption) => { Console.WriteLine($"The value for --int-option is: {intOption}"); Console.WriteLine($"The value for --bool-option is: {boolOption}"); Console.WriteLine($"The value for --file-option is: {fileOption?.FullName ?? "null"}"); }); // Parse the incoming args and invoke the handler return rootCommand.InvokeAsyncInvoke(args).Result;
}
}