Skip to content
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

Dynamically wrap argument and option descriptions based on console width in the default help text generator. #248

Merged

Conversation

kyle-rader
Copy link
Contributor

Dynamic description wrapping in generated help text

This addresses my two concerns in issue #246.

New Behavior

  • Now, description lines will dynamically wrap with a padded newline at the current console width.
  • Explicit newlines in the descriptions will be preserved still, but now in a cross platform friendly way: either \n or \r\n will result in a padded newline.

@natemcmaster
Copy link
Owner

Hey there, just letting you know I've seen this, but haven't reviewed it. I'm on vacation for 2 more weeks without a laptop, and I'll take a closer look when I'm home.

@kyle-rader
Copy link
Contributor Author

kyle-rader commented Jul 1, 2019 via email

Copy link
Owner

@natemcmaster natemcmaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This one is particularly well done. I'm glad to see you have added tests, removed some duplicated code, and documented all new API.

I have a few suggestions on how I'd like to tweak this change before merging. What you have appears to be fully functional already, so if you don't have time to update your PR, I can merge and make the changes myself. Let me know either way!

Thanks,
Nate

src/CommandLineUtils/HelpText/DefaultHelpTextGenerator.cs Outdated Show resolved Hide resolved
src/CommandLineUtils/HelpText/DefaultHelpTextGenerator.cs Outdated Show resolved Hide resolved
src/CommandLineUtils/HelpText/DescriptionFormatter.cs Outdated Show resolved Hide resolved
src/CommandLineUtils/HelpText/DefaultHelpTextGenerator.cs Outdated Show resolved Hide resolved
src/CommandLineUtils/HelpText/DescriptionFormatter.cs Outdated Show resolved Hide resolved
test/CommandLineUtils.Tests/DescriptionFormatterTests.cs Outdated Show resolved Hide resolved
src/CommandLineUtils/HelpText/DescriptionFormatter.cs Outdated Show resolved Hide resolved
src/CommandLineUtils/HelpText/DescriptionFormatter.cs Outdated Show resolved Hide resolved
src/CommandLineUtils/HelpText/DefaultHelpTextGenerator.cs Outdated Show resolved Hide resolved
@kyle-rader
Copy link
Contributor Author

@natemcmaster acking - will take a look tonight again Thanks for making the HelpTextGenerator extendable. I added this functionality into our app a few weeks ago that way.

@kyle-rader kyle-rader force-pushed the feature/description-wrapping branch from 10f88ff to 9b86617 Compare July 27, 2019 01:00
@kyle-rader
Copy link
Contributor Author

@natemcmaster Great suggestions, thanks for the review. I've resolved all comments.

@kyle-rader
Copy link
Contributor Author

I've also rebased onto master.

@kyle-rader kyle-rader changed the title Feature/description wrapping Dynamically wrap argument and options descriptions based on console width in the default help text generator. Jul 27, 2019
@kyle-rader kyle-rader changed the title Dynamically wrap argument and options descriptions based on console width in the default help text generator. Dynamically wrap argument and option descriptions based on console width in the default help text generator. Jul 27, 2019
@natemcmaster
Copy link
Owner

Looks great! Thanks for updating with my feedback. This will be in the 2.4.0 RC release, which I'm hoping to release in a few weeks.

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