Esempio n. 1
0
        internal static BenchmarkConfig From(string[] args)
        {
            BenchmarkConfig options = null;
            Parser          parser  = new Parser((settings) =>
            {
                settings.CaseSensitive = false;
                settings.HelpWriter    = Console.Error;
                settings.AutoHelp      = true;
            });

            parser.ParseArguments <BenchmarkConfig>(args)
            .WithParsed <BenchmarkConfig>(e => options = e)
            .WithNotParsed <BenchmarkConfig>(e => BenchmarkConfig.HandleParseError(e));

            if (options.PublishResults)
            {
                if (string.IsNullOrEmpty(options.ResultsContainer) ||
                    string.IsNullOrWhiteSpace(options.ResultsPartitionKeyValue) ||
                    string.IsNullOrWhiteSpace(options.CommitId) ||
                    string.IsNullOrWhiteSpace(options.CommitDate) ||
                    string.IsNullOrWhiteSpace(options.CommitTime))
                {
                    throw new ArgumentException($"Missing either {nameof(options.ResultsContainer)} {nameof(options.ResultsPartitionKeyValue)} {nameof(options.CommitId)} {nameof(options.CommitDate)} {nameof(options.CommitTime)}");
                }
            }

            return(options);
        }
        internal static BenchmarkConfig From(string[] args)
        {
            BenchmarkConfig options = null;

            Parser.Default.ParseArguments <BenchmarkConfig>(args)
            .WithParsed <BenchmarkConfig>(e => options = e)
            .WithNotParsed <BenchmarkConfig>(e => BenchmarkConfig.HandleParseError(e));

            return(options);
        }
Esempio n. 3
0
        internal static BenchmarkConfig From(string[] args)
        {
            BenchmarkConfig options = null;

            Parser.Default.ParseArguments <BenchmarkConfig>(args)
            .WithParsed <BenchmarkConfig>(e => options = e)
            .WithNotParsed <BenchmarkConfig>(e => BenchmarkConfig.HandleParseError(e));

            if (options.PublishResults)
            {
                if (string.IsNullOrEmpty(options.ResultsContainer) ||
                    string.IsNullOrWhiteSpace(options.ResultsPartitionKeyValue) ||
                    string.IsNullOrWhiteSpace(options.CommitId) ||
                    string.IsNullOrWhiteSpace(options.CommitDate) ||
                    string.IsNullOrWhiteSpace(options.CommitTime))
                {
                    throw new ArgumentException($"Missing either {nameof(options.ResultsContainer)} {nameof(options.ResultsPartitionKeyValue)} {nameof(options.CommitId)} {nameof(options.CommitDate)} {nameof(options.CommitTime)}");
                }
            }

            return(options);
        }