Readd commandline parsing

This commit is contained in:
Jens True 2022-06-17 23:23:01 +02:00
parent aabb14049a
commit 3dff33540b
2 changed files with 14 additions and 2 deletions

@ -1,5 +1,5 @@
using System; using System;
using System.CommandLine; using CommandLine;
using System.Collections.Generic; using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
@ -8,12 +8,23 @@ namespace Tidstagning
class Program class Program
{ {
public class Options
{
[Option('c', "config", Required = false, HelpText = "Enable configuration menu.")]
public bool Verbose { get; set; }
}
[STAThread] [STAThread]
static void Main(string[] args) static void Main(string[] args)
{
Parser.Default.ParseArguments<Options>(args)
.WithParsed<Options>(o =>
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainUI()); Application.Run(new MainUI(o.Verbose));
});
} }

@ -9,6 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="System.IO.Ports" Version="6.0.0" /> <PackageReference Include="System.IO.Ports" Version="6.0.0" />
</ItemGroup> </ItemGroup>