using System.CommandLine.Invocation;
using System.IO;
using System.Reflection;
public class Program
static int Main(string[] args)
{
RootCommand var converterOption = new Argument<string>("converter", "Converter Name"); var infoOption = new Option<bool>(new string[] { "-i", "--info" }, "information"); var rootCommand = new RootCommand({ converterOption, infoOption }; description: rootCommand.Description = "SimpleConvert");
rootCommand.SetHandler((string converter, bool info)=> { Console.WriteLine($"TEST{converter} {info}"); }, converterOption, infoOption);
return rootCommand.Invoke(args);
}
}
</pre>
<pre>
Description:
Convert
hogehoge <converter> [options]
Arguments:
<converter> Converter Name
Options:
-i, --info information
--version Show version information
-?, -h, --help Show help and usage information
> dotnet run "conv"
conv False
</pre>