Closed
Description
anstream
provides the same feature set as termcolor
(including legacy windows support) but with a less awkward API to work with. Instead of hand-constructing data in a special container with each step requiring setting the style, you use whatever styling library you like (e.g. color-print like in #12578) and then write to the appropriate stream, and you are done. The stream does all the rest, allowing styling to be decoupled from where it is being rendered.
So anstream
would replace
termcolor
fwdansi
strip-ansi-escapes
Benefits
- Lower boilerplate way to style text while leaving
Shell
in control (seecargo add
s use ofShell::write_stderr
) - Open the door for styling within messages
- Lower overhead as it only intercepts when something needs changing. This will be especially true in switching from
fwdansi
toanstream
- Strip API is significantly faster than
strip-ansi-escapes
- Centralize color schemes between
Shell
(currently using termcolor) andclap
(usinganstyle
)