Make `iter` and `into_iter` part of the public interface in `StyledStr`
Closed this issue · 4 comments
Please complete the following tasks
- I have searched the discussions
- I have searched the open and rejected issues
Clap Version
4.0.32
Describe your use case
I am using clap to power an in-game console, I'd rather not parse ansii characters back to colour information to format the text.
Describe the solution you'd like
Make the iteration functionality of StyledStr part of the public interface
Alternatives, if applicable
No response
Additional Context
No response
The internals of StyledStr
are not public because they are subject to change which will happen soon. Our plan is to write ANSI codes directly into a String
and strip them when needed, so you doing that on your side aligns with where we are going.
The original reason we are doing this is to allow users to provide formatted text without having to also maintaining a bespoke formatting API for #1433, #3108. We also found that the current approach is very expensive in binary size terms which are we working to reduce (#1365).
Hmm so would formatting be done by writing ANSI into the StyledStr
or String
directly? Is it at least going to be possible to force ansii output, without using the cross-platform capabilities of termcolor ?
StyledStr
will be a newtype around String
with the same API as today (ability to get a Display
with and without ansi codes).
Users can use their crate of choice (e.g. owo-colors) to write ansi codes to a StyledStr
. We will either
- (no tty) Strip those codes
- (unix) Write the codes
- (windows) Output the codes if supported, otherwise turn them into wincon calls
As most of the work of termcolor
will not be needed, my plan is to write a minimal crate to support the above policy.
I see, thanks!