It would be nice to make the textwrap crate an optional dependency, so that those who don't care that much about the nice formatting wouldn't need to install the transitive closure of the dependencies of textwrap (most notably, libc and winapi).
This would also cut down on the quantity of unsafe used (again, transitively) by the dependent crates, should they choose to opt out of pretty help text wrapping.
I'd be fine with this, if someone wants an easy PR.
:+1:
Sure thing, I'll make the PR for this one as well.
Looks like we'll need to discuss this one a bit more. Here's the complete problem scenario:
wrap_help enabled, it will wrap the text respecting the actual with of the terminal rather than assuming 120 columns. It also says that this feature will build the term_size crate as a dependency.term_size is not necessary when this feature is disabled. However, textwrap is a non-optional dependency, and it has term_size as a non-optional dependency itself. This means that term_size is always a dependency.textwrap should also make term_size an optional dependency; better yet, a non-dependency? As far as I can tell, that crate does not internally rely on knowing the terminal width; it merely provides a convenience callthrough/adaptor interface for term_size. I think that it is poor code organization to hard depend on a crate that is not used directly, only for the sake of providing a convenience adaptor for it.textwrap crate's author and ask him/her to remove term_size as a dependency before I can continue implementing this PR.The issue referred above has been resolved lightning fast. 馃憤 Once the next release of textwrap is out, I'll write up the necessary changes as a pull request.
Textwrap 0.9.0 has been released with this change, have fun! :-)
Thanks @mgeisler for being flexible and helping with this!
@kbknapp @mgeisler Thanks for your responsiveness and collaboration!
Happy to help! I want my little crate to be useful in as many scenarios as possible.
Most helpful comment
Textwrap 0.9.0 has been released with this change, have fun! :-)