/// <summary> /// Executes the "configure" action /// </summary> /// <param name="opts">command-line options</param> /// <returns>exit code</returns> private static int Configure(ConfigureOptions opts) { var config = File.Exists(opts.ConfigFile) ? JiraKanbanConfig.ParseXml(opts.ConfigFile) : new JiraKanbanConfig(); if (opts.JiraUsername != null) { config.JiraUsername = opts.JiraUsername; } if (opts.JiraInstanceBaseAddress != null) { config.JiraInstanceBaseAddress = opts.JiraInstanceBaseAddress; } if (opts.BoardId != null) { config.BoardId = opts.BoardId.Value; } if (!opts.NoStorePassword && !string.IsNullOrWhiteSpace(config.JiraUsername)) { Console.WriteLine($"Enter the Jira password for user '{config.JiraUsername}':"); config.JiraPassword = GetPassword(); } var xml = config.ToXml(); using (var f = File.OpenWrite(opts.ConfigFile)) xml.Save(f); Console.WriteLine($"Configuration file generated at: {opts.ConfigFile}"); return(0); }
/// <summary> /// Executes the "generate" action /// </summary> /// <param name="opts">command-line options</param> /// <returns>exit code</returns> private static int Generate(GenerateOptions opts) { if (!File.Exists(opts.ConfigFile)) { var color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"ERROR: Configuration file does not exist: {opts.ConfigFile}"); Console.ForegroundColor = color; return(1); } var config = JiraKanbanConfig.ParseXml(opts.ConfigFile); if (opts.BoardId != null) { config.BoardId = opts.BoardId.Value; } var issues = GetIssues(opts, config); var charts = KanbanCharts.Create(config, issues); SaveChart(opts, charts.FlowEfficiencyChart, "FlowEfficiencyChart.png"); SaveChart(opts, charts.LeadTimeHistogramChart, "LeadTimeHistogramChart.png"); SaveChart(opts, charts.WeeklyThroughputHistogramChart, "WeeklyThroughputHistogramChart.png"); SaveChart(opts, charts.WeeklyThroughputChart, "WeeklyThroughputChart.png"); SaveChart(opts, charts.LeadTimeControlChart, "LeadTimeControlChart.png"); SaveChart(opts, charts.CumulativeFlowDiagramChart, "CumulativeFlowDiagramChart.png"); Console.WriteLine("Success !!!"); return(0); }