Exemplo n.º 1
0
        /// <summary>
        /// Usage を生成して出力します。
        /// </summary>
        /// <param name="usageBuilder">CommandUsageBuilder</param>
        private static void OutputUsage(CommandUsageBuilder usageBuilder)
        {
            usageBuilder.Summary = "Apache のアクセスログを集計して、時間帯ごともしくはホストごとのアクセス数を出力します。";
            usageBuilder.AddUseCase(usageBuilder.NewUseCase()
                                    .AddArg(usageBuilder.NewUseCaseArg("-o").Value("SummaryFileName").AsOptional())
                                    .AddArg(usageBuilder.NewUseCaseArg("-t").Value("ByHourSummaryFileName").AsOptional())
                                    .AddArg(usageBuilder.NewUseCaseArg("-h").Value("ByHostSummaryFileName").AsOptional())
                                    .AddArg(usageBuilder.NewUseCaseArg("-s").Value("StartDate").AsOptional())
                                    .AddArg(usageBuilder.NewUseCaseArg("-e").Value("EndDate").AsOptional())
                                    .AddArg(usageBuilder.NewUseCaseArg("INPUT").AsMultiple()));

            Console.WriteLine(usageBuilder.ToString());
        }
        public string BuildsUsageString(string command, string summary, CommandOption[] options, CommandUseCase[] useCases)
        {
            var builder = new CommandUsageBuilder(command, options);

            builder.Summary = summary;

            foreach (var usecase in useCases)
            {
                builder.AddUseCase(usecase);
            }

            return(builder.ToString());
        }