add McMaster.Extensions.CommandLineUtils and first sample code

This commit is contained in:
Gregor Biswanger
2017-10-04 03:09:57 +02:00
parent 35946c3fdc
commit 25834abc2b
2 changed files with 33 additions and 3 deletions

View File

@@ -12,4 +12,8 @@
<Version>1.0.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.0.0" />
</ItemGroup>
</Project>

View File

@@ -1,12 +1,38 @@
using System;
using McMaster.Extensions.CommandLineUtils;
using System;
using System.IO;
namespace ElectronNET.CLI
{
class Program
{
static void Main(string[] args)
static int Main(string[] args)
{
Console.WriteLine("Hello World from electronize xy");
var app = new CommandLineApplication();
app.Name = "electronnet";
app.HelpOption("-?|-h|--help");
app.OnExecute(() =>
{
Console.WriteLine("Hello World!");
return 0;
});
app.Command("start", (command) => {
command.Description = "Start ASP.NET Core project with Electron.";
command.HelpOption("-?|-h|--help");
command.Argument("path", "Path to the ASP.NET Core project");
command.OnExecute(() => {
Console.WriteLine(Directory.GetCurrentDirectory());
Console.WriteLine(command.Arguments[0].Value);
});
});
return app.Execute(args);
}
}
}