1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-07-16 22:42:20 +02:00

termcolor: add support for output to standard error

This is essentially a rename of the existing `Stdout` type to `StandardStream`
and a change of its constructor from a single `new()` function to have two
`stdout()` and `stderr()` functions.

Under the hood, we add add internal IoStandardStream{,Lock} enums that allow
us to abstract between Stdout and Stderr conveniently. The rest of the needed
changes then fall out fairly naturally.

Fixes #324.

[breaking-change]
This commit is contained in:
Peter Williams
2017-02-05 11:02:54 -05:00
committed by Andrew Gallant
parent e424f87487
commit 22cb644eb6
3 changed files with 233 additions and 108 deletions

View File

@ -182,8 +182,8 @@ impl Args {
}
/// Create a new writer for single-threaded searching with color support.
pub fn stdout(&self) -> termcolor::Stdout {
termcolor::Stdout::new(self.color_choice)
pub fn stdout(&self) -> termcolor::StandardStream {
termcolor::StandardStream::stdout(self.color_choice)
}
/// Returns a handle to stdout for filtering search.