Skip to content

Commit

Permalink
make module list available via --help
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljon committed May 18, 2022
1 parent 51c11de commit 3849d00
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,23 @@ private static void Main(string[] args)

static void DisplayHelp<T>(ParserResult<T> result, IEnumerable<Error> _)
{
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);
}
Expand Down

0 comments on commit 3849d00

Please sign in to comment.