Example #1
0
        public static void DefaultParsingErrorsHandler(CommandLineOptionsBase options, HelpText current)
        {
            if (options == null) throw new ArgumentNullException("options");
            if (current == null) throw new ArgumentNullException("current");

            if (options.InternalLastPostParsingState.Errors.Count <= 0)
                return;

            var errors = current.RenderParsingErrorsText(options, 2); // indent with two spaces
            if (string.IsNullOrWhiteSpace(errors))
                return;

            current.AddPreOptionsLine(string.Concat(Environment.NewLine, current.SentenceBuilder.ErrorsHeadingText));

            var lines = errors.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            foreach (var line in lines) { current.AddPreOptionsLine(line); }
        }