-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it easier to configure HelpText #458
base: develop
Are you sure you want to change the base?
Make it easier to configure HelpText #458
Conversation
I understand you can also configure HelpText using the pattern described in #224 but I think this approach is cleaner.
|
src/CommandLine/Text/HelpText.cs
Outdated
/// <param name="config">The configuration for the help-text</param> | ||
/// <remarks>The parameter <paramref name="verbsIndex"/> is not only a metter of formatting, it controls whether to handle verbs or options.</remarks> | ||
//REVIEW - I believe this is only public for test purposes and is not a client API hence I have not supplied | ||
//a backwards compatibility version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reading some of the old issues, it does look like calling this was the recommended way to get custom output so a backwards compatibility version is probably needed unless the major version is bumped.
This fixes issues commandlineparser#414 and commandlineparser#455 (value of AutoHelp and AutoVersion are ignored by HelpText)
@moh-hassan @nemec Sorry to tag you but @ericnewton76 suggested you were also involved in reviewing/approving PRs. This one would probably need to be merged with #461 (or vice-versa). |
Thanks @NeilMacMullen for your effort on this PR.
|
@moh-hassan This PR now includes the changes made in #461. As a result, #461 should not be merged. Readme.md has been updated to explain the new (preferred) configuration scheme. Old methods preserved for backwards compatibility have been marked as Obsolete. |
I've just realised that the design would be a little better if the Parser.Setxxx mutators returned a new Parser otherwise Parser.Default is mutated (which is probably why tests are sometimes failing as they are being run in paralllel. I'll fix that up tomorrow. |
I agree that returning a new Parser otherwise Parser.Default is a better design. |
@moh-hassan I've been thinking about the PR a lot. To be honest I don't think it is possible to clean up the configuration mechanism properly while also maintaining backwards compatibility. Problems with the current design include:
So I'm going to reluctantly drop this. I'd be happy do the work to create a better configuration mechanism but it would have to include breaking changes. |
I understand your concerns and creating a better configuration mechanism can be done in a major build version which may be a Fluent Interface and can benefit of the new feature of C# 8. |
@moh-hassan Thanks. I'm inclined to knock off a few of the more minor outstanding bugs/issues first. I understand that you are doing this in your spare time :-) but was wondering if you have a particular roadmap in mind? I.e. is there a deadline to get minor/breaking PRs in submitted? |
The roadmap in mind is fixing some open hot issues and new features and coordinate with @ericnewton76 for the next release. |
I tried to run integration test with PR #356 (help localization) after rebasing with develop, the build success and the test fail for 9 (nine) test cases. The common error related to
The integeration branch localize3 and CI appveyor result here. The xunit test report: |
@moh-hassan It's because the localisation PR has changed the default value of BaseAttribute.HelpText from string.empty to null. It can be fixed by initialising LocalizableAttributeProperty._value to string.Empty |
Something like this is definitely needed. Right now it seems that the only choices are go with the auto help, or roll your own inside of I think exposing some of this on |
Thanks @NeilMacMullen I did a modification by Seting Helptext property default to string.Empty |
b211712
to
746885a
Compare
The purpose of this change is to simplify configuration of the help-text output.
The HelpText class has lots of useful flags for controlling the way output is displayed but they are currently cumbersome to access. This PR allows you to write code such as...
In addition, the old MaximumDisplayWidth and TextWriter properties have been moved into the HelpTextConfiguration and exposed via a fluent API in Parser to avoid clients having to access too many of the class internals so you can write..
The old config accessors are still provided as a backwards compatibility measure. but should be deprecated IMHO.