forked from rust-lang/cargo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#12751 - epage:color, r=arlosi
refactor: Switch from termcolor to anstream ### What does this PR try to resolve? `anstream` asks the question "what if you took `fwdansi` and removed `termcolor` underneath it. It wraps output streams, adapting ANSI escape codes to what is needed - Pass through if its supported - Strip if its not - Adapt to wincon API if needed Benefits - Lower boilerplate: we can use `write!` with styled text rather than the back-and-forth between colors and writing that termcolor needs - Allows richer styling as `Shell` can accept styled messages and adapt them as needed Side effects - We'll now respect [NO_COLOR](https://no-color.org/), [CLICOLOR_FORCE](https://bixense.com/clicolors/), and [CLICOLOR](jhasse/clicolors@3a22aaa) Fixes rust-lang#12627 ### How should we test and review this PR? This is broken up by commits for easier browsing. However, as there aren't really tests for colored output, this needs hand inspection to verify ### Additional information This allowed us to remove the need for stripping ansi escape codes completely. Even if it didn't, it exposes its internal stripping API for reuse, saving on a dependency and being significantly faster.
- Loading branch information
Showing
8 changed files
with
105 additions
and
294 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.