コード例 #1
0
ファイル: Program.cs プロジェクト: kthompson/csharpos
        static void Main(string[] args)
        {
            var outputFile = string.Empty;
            var parser = new OptionParser
            {
                new Option
                {
                    ShortForm = "o",
                    LongForm = "output",
                    Required = true,
                    ActionWithParam = option => outputFile = option
                },
            };

            var inputs = parser.Parse(args);
            if (inputs.Length == 0)
                return;

            Console.WriteLine("Usage: compiler -o output.exe input.exe");
            Console.WriteLine(parser.GetUsage());

            //FIXME: make this use architecture etc
            //var assembly = AssemblyFactory.GetAssembly(inputs[0]);
            //var compiler = new AssemblyCompiler(new MethodCompilerStage(), new GccBuildStage(outputFile));
            //var context = new AssemblyCompilerContext(assembly, assembly.EntryPoint);
            //compiler.Compile(context);
        }
コード例 #2
0
        public void GetUsageTests()
        {
            var options = new Options();
            var parser  = new OptionParser
            {
                new Option {
                    ShortForm = "a", LongForm = "alpha", Required = true, Action = () => options.A = true, Description = "Set the alpha standing"
                },
                new Option {
                    ShortForm = "b", LongForm = "bravo", Action = () => options.B = true, Description = "Set the bravo standing"
                },
                new Option {
                    ShortForm = "c", LongForm = "charlie", Action = () => options.C = true, Description = "Set the charlie standing"
                },
                new Option {
                    ShortForm = "d", LongForm = "delta", ActionWithParam = param => options.D = param, Description = "Set the delta standing"
                },
            };


            parser.GetUsage();
        }