Make term_size an optional dependency
H2CO3 opened this issue · 3 comments
Currently, term_size
is a required dependency of this crate. This means that all consumers of this library must also install the transitive closure of term_size
's dependencies, even those who are not willing to use its functionality.
This is an especially important consideration given that term_size
makes heavy use of unsafe
, so crates with a zero-unsafe policy (such as one I am currently authoring) may not be able to use textwrap
even though they don't actually need any of its unsafe
-dependent functionality.
Since with_termwidth()
is more or less trivial, and the termwidth()
function literally just wraps term_size
with a hardcoded default value, it seems to me that it is not the right trade-off that has been made in this regard.
Consequently, I suggest one of the following, in decreasing order of preference:
- Remove the
term_size
dependency,termwidth()
, andwith_termwidth()
altogether, because the latter two are trivial and the default value of 80 might not be suitable for everyone anyway. - Make
with_termwidth()
andtermwidth()
a non-default, optional feature andterm_size
an optional dependency, so they are not included by default, but those who are willing to use the functionality can still continue doing so without breaking code changes. - Make
with_termwidth()
andtermwidth()
a default, optional feature andterm_size
an optional dependency, so they are included by default, but those who are not willing to use the functionality can opt out.
This is blocking clap-rs/clap#1055.