private void HandleParsingErrorsInHelp(HelpText help) { if (this.LastPostParsingState.Errors.Count > 0) { var errors = help.RenderParsingErrorsText(this, 2); // indent with two spaces if (!string.IsNullOrEmpty(errors)) { help.AddPreOptionsLine(string.Concat(Environment.NewLine, "ERROR(S):")); help.AddPreOptionsLine(errors); } } }
public static void DefaultParsingErrorsHandler(CommandLineOptionsBase options, HelpText current) { if (options.InternalLastPostParsingState.Errors.Count > 0) { var errors = current.RenderParsingErrorsText(options, 2); // indent with two spaces if (!string.IsNullOrEmpty(errors)) { current.AddPreOptionsLine(string.Concat(Environment.NewLine, current.SentenceBuilder.ErrorsHeadingText)); //current.AddPreOptionsLine(errors); var lines = errors.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); foreach (var line in lines) { current.AddPreOptionsLine(line); } } } }