Added option parsing to the main program.
authorJarl Gullberg <jarl.gullberg@gmail.com>
Mon, 26 Jun 2017 19:01:30 +0000 (21:01 +0200)
committerJarl Gullberg <jarl.gullberg@gmail.com>
Sat, 19 Aug 2017 16:26:33 +0000 (18:26 +0200)
src/Generator.Rewrite/Generator.Rewrite.csproj
src/Generator.Rewrite/Program.cs

index 3834892..518e5ae 100644 (file)
@@ -59,6 +59,7 @@
   <ItemGroup>
     <Compile Include="CountAttribute.cs" />
     <Compile Include="GeneratedVariableIdentifier.cs" />
+    <Compile Include="Options.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
index f028ff3..02c44cb 100644 (file)
@@ -18,7 +18,7 @@ using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-
+using CommandLine;
 using Mono.Cecil;
 using Mono.Cecil.Cil;
 using Mono.Cecil.Rocks;
@@ -29,14 +29,12 @@ namespace OpenTK.Rewrite
     // with the s IL instructions.
     internal class Program
     {
+        private static readonly Options Options = new Options();
+
         private static void Main(string[] args)
         {
-            if (args.Length == 0)
+            if (!Parser.Default.ParseArguments(args, Options))
             {
-                Console.WriteLine("Usage: rewrite [file.dll] [file.snk] [options]");
-                Console.WriteLine("[options] is:");
-                Console.WriteLine("    -debug (enable calls to GL.GetError())");
-                Console.WriteLine("    -dllimport (force calls to use DllImport instead of GetProcAddress)");
                 return;
             }