Skip to content

Fix issues for HelpText.AutoBuild configuration (issues #224 , # 259)#467

Merged
moh-hassan merged 4 commits intocommandlineparser:developfrom
moh-hassan:helptext-autobuild
Jul 26, 2019
Merged

Fix issues for HelpText.AutoBuild configuration (issues #224 , # 259)#467
moh-hassan merged 4 commits intocommandlineparser:developfrom
moh-hassan:helptext-autobuild

Conversation

@moh-hassan
Copy link
Copy Markdown
Collaborator

HelpText.AutoBuild can't apply setting on HelpText to add AdditionalNewLineAfterOption and other setting.
These setting are applied only when parser raise parsing errors.
This PR fix this bug and fix issue #224 , #259 .
You have a complete control on HelpText configuration in custom help.
Also, new extension methods IsHelp() /IsVersion() is added to simplify checking errors if it have help/version option.

        var parser = new Parser(x =>
        {
            x.HelpWriter = null;               
        });
        var result = parser.ParseArguments<Simple_Options>(new[]{"--help"});
        //generate custom help 
        result .WithNotParsed(errs =>
        {               
            var helpText = HelpText.AutoBuild(result,
                h =>
                {
				    //configure help
                    h.AdditionalNewLineAfterOption = false;
                    return h;
                }
                , e => e);
             //print help screen
            Console.WriteLine(helpText);
             
        });

@moh-hassan
Copy link
Copy Markdown
Collaborator Author

This PR also fix #414 and #455

@moh-hassan moh-hassan merged commit 2580024 into commandlineparser:develop Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants