Command Line with arguments
Example
$ dotnet new console -n CommandLineExample -o CommandLineExample$ dotnet add package McMaster.Extensions.CommandLineUtilsusing Microsoft.Extensions.CommandLineUtils;using Microsoft.Extensions.CommandLineUtils;
using System;
namespace CommandLineExample
{
class Program
{
static void Main(string[] args)
{
var app = new CommandLineApplication();
app.Name = "ninja";
app.Description = ".NET Core console app with argument parsing.";
app.HelpOption("-?|-h|--help");
app.OnExecute(() =>
{
Console.WriteLine("Hello World!");
return 0;
});
app.Execute(args);
}
}
}Commands
Generate the exe
Reference
Last updated