-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Wrap help lines at term width #428
Comments
I'm very interested in this. This is currently basically impossible to emulate manually and it makes long help texts very hard to read because when the term wraps, it does not align with the start of the message. As an example from an app i have:
|
I have a working local stash of this feature. The downside is that's a naive implementation and doesn't wrap by word, i.e. some words get cut in the middle. I'm going to continue playing with this as I have some ideas to improve it and at least get it to wrap where it's aesthetically pleasing. @mitsuhiko your example above will end up outputting:
|
Just an update, my free time has been almost non-existent, but I'm hoping to have this complete over the next few days. More updates to follow... |
Finally, after some back to the drawing board moments I have this working in a whitespace respecting way (i.e. it doesn't cut words in the middle). I'm updating tests now, and should have a PR in tonight. Once merged I'll go ahead and put out 2.2.0. |
By default `clap` now automatically wraps and aligns help strings to the term width. i.e. ``` -o, --option <opt> some really long help text that should be auto aligned but isn't righ t now ``` Now looks like this: ``` -o, --option <opt> some really long help text that should be auto aligned but isn't right now ``` The wrapping also respects words, and wraps at spaces so as to not cut words in the middle. This requires the `libc` dep which is enabled (by default) with the `wrap_help` cargo feature flag. Closes #428
PR is in, here's a screenshot of what the term wrapping looks like using some arbitrary test options and flags. Term width is 66: Edit: |
An aside, what font is that? |
Inconsolata, I love it. |
No description provided.
The text was updated successfully, but these errors were encountered: