You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RenderParsingErrorsText() returns a string with linebreaks if there are multiple errors. When passed to Add<>OptionsLine, it is wrapped every 80 characters regardless of newlines, causing incorrect wrapping.
[ParserState]
public IParserState LastParserState { get; set; }
[Option('a', "qwe", Required = true)]
public string a { get; set; }
[Option('b', "asd", Required = true)]
public double b { get; set; }
[Option('c', "zxc", Required = true)]
public bool c { get; set; }
[HelpOption]
public string GetUsage()
{
var help = new HelpText();
// ...
if (this.LastParserState.Errors.Count > 0)
{
var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces
if (!string.IsNullOrEmpty(errors))
{
help.AddPreOptionsLine(string.Concat("\n", "ERROR(S):"));
help.AddPreOptionsLine(errors);
}
}
// ...
return help;
}
>foo.exe
ERROR(S):
-a/--qwe required option is missing.
-b/--asd required option is
missing.
-c/--zxc required option is missing.
As you can see, the second error line gets incorrectly wrapped.