From 3849d00b131fec2a2a8b9ff98324792352f2dfe4 Mon Sep 17 00:00:00 2001 From: Michaeljon Miller Date: Wed, 18 May 2022 15:39:18 -0700 Subject: [PATCH] make module list available via --help --- Program.cs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Program.cs b/Program.cs index 4368556..d1d5f20 100644 --- a/Program.cs +++ b/Program.cs @@ -45,22 +45,23 @@ private static void Main(string[] args) static void DisplayHelp(ParserResult result, IEnumerable _) { - var moduleList = ModuleFactory.ModuleMap; var sb = new StringBuilder("List of available modules for --modules:").AppendLine(); - - foreach (var module in moduleList) + foreach (var module in ModuleFactory.ModuleMap) { sb.AppendLine($"\t{module.Key} -> {module.Value.Description}"); } - var helpText = HelpText.AutoBuild(result, h => - { - h.AdditionalNewLineAfterOption = false; - h.MaximumDisplayWidth = 120; - h.AddPostOptionsText(sb.ToString()); - - return HelpText.DefaultParsingErrorsHandler(result, h); - }, e => e); + var helpText = HelpText.AutoBuild(result, + h => + { + h.AdditionalNewLineAfterOption = false; + h.MaximumDisplayWidth = 120; + h.AddPostOptionsText(sb.ToString()); + + return HelpText.DefaultParsingErrorsHandler(result, h); + }, + e => e + ); Console.Error.WriteLine(helpText); }