Пример #1
0
        static string RunAsCommand(string[] args)
        {
            var root = new RootCommand("RingBuffer BenchmarkApp")
            {
                new Option <string>("--role", "--role")
                {
                }
            };
            var parseResult = new CommandLineBuilder(root)
                              .Build()
                              .Parse(args);

            if (parseResult.Errors.Count > 0)
            {
                foreach (var erro in parseResult.Errors)
                {
                    Console.WriteLine(erro.Message);
                }

                throw new InvalidOperationException();
            }
            Console.WriteLine(parseResult.Diagram());


            var role = parseResult.ValueForOption <string>("role");

            return(role);
        }