From 25834abc2b4bedc69e2785800c20eaa498c56be8 Mon Sep 17 00:00:00 2001 From: Gregor Biswanger Date: Wed, 4 Oct 2017 03:09:57 +0200 Subject: [PATCH] add McMaster.Extensions.CommandLineUtils and first sample code --- ElectronNET.CLI/ElectronNET.CLI.csproj | 4 ++++ ElectronNET.CLI/Program.cs | 32 +++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ElectronNET.CLI/ElectronNET.CLI.csproj b/ElectronNET.CLI/ElectronNET.CLI.csproj index 7a7107b..bfc6933 100644 --- a/ElectronNET.CLI/ElectronNET.CLI.csproj +++ b/ElectronNET.CLI/ElectronNET.CLI.csproj @@ -12,4 +12,8 @@ 1.0.0 + + + + diff --git a/ElectronNET.CLI/Program.cs b/ElectronNET.CLI/Program.cs index ae703d3..79776be 100644 --- a/ElectronNET.CLI/Program.cs +++ b/ElectronNET.CLI/Program.cs @@ -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); } } }