Exemplo n.º 1
0
            public override void Done()
            {
                var args = GetAndResetAdditionalArguments();

                if (args.Count != 0)
                {
                    Next = CommandLineOptionsParser.Parse <Options>(args);
                }
            }
Exemplo n.º 2
0
        public void SimpleExample()
        {
            // Note: In real-world code, don't parse the command line yourself; just call CommandLineOptionsParser.Parse without any arguments.
            var commandLine = Win32CommandLineLexer.Instance.Lex("test.mp4 -l smith --flag");
            var options     = CommandLineOptionsParser.Parse <Options>(commandLine);

            Assert.Equal("test.mp4", options.Filename);
            Assert.True(options.Flag);
            Assert.Equal("smith", options.Label);
        }
Exemplo n.º 3
0
 public override void Done()
 {
     if (Command == Commands.Measure)
     {
         Measure = CommandLineOptionsParser.Parse <MeasureOptions>(GetAndResetAdditionalArguments());
     }
     else if (Command == Commands.Cut)
     {
         Cut = CommandLineOptionsParser.Parse <CutOptions>(GetAndResetAdditionalArguments());
     }
     else if (Command == Commands.Help)
     {
         Help = CommandLineOptionsParser.Parse <HelpOptions>(GetAndResetAdditionalArguments());
     }
 }
Exemplo n.º 4
0
 public static T Parse <T>(params string[] commandLine) where T : class, ICommandLineOptions => CommandLineOptionsParser.Parse <T>(commandLine);