mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-02 21:21:58 -07:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cc6b6dcf5b | ||
|
48878bbb8f |
@@ -16,7 +16,7 @@ cache: cargo
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- PROJECT_NAME=xrep
|
- PROJECT_NAME=ripgrep
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# Nightly channel
|
# Nightly channel
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
environment:
|
environment:
|
||||||
global:
|
global:
|
||||||
PROJECT_NAME: rg
|
PROJECT_NAME: ripgrep
|
||||||
matrix:
|
matrix:
|
||||||
# Nightly channel
|
# Nightly channel
|
||||||
- TARGET: i686-pc-windows-gnu
|
- TARGET: i686-pc-windows-gnu
|
||||||
|
12
src/out.rs
12
src/out.rs
@@ -9,25 +9,25 @@ use term::WinConsole;
|
|||||||
|
|
||||||
use terminal::TerminfoTerminal;
|
use terminal::TerminfoTerminal;
|
||||||
|
|
||||||
pub type StdoutTerminal = Box<Terminal<Output=io::BufWriter<io::Stdout>> + Send>;
|
pub type StdoutTerminal = Box<Terminal<Output=io::Stdout> + Send>;
|
||||||
|
|
||||||
/// Gets a terminal that supports color if available.
|
/// Gets a terminal that supports color if available.
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn term_stdout(color: bool) -> StdoutTerminal {
|
fn term_stdout(color: bool) -> StdoutTerminal {
|
||||||
let stdout = io::BufWriter::new(io::stdout());
|
let stdout = io::stdout();
|
||||||
WinConsole::new(stdout)
|
WinConsole::new(stdout)
|
||||||
.ok()
|
.ok()
|
||||||
.map(|t| Box::new(t))
|
.map(|t| Box::new(t) as StdoutTerminal)
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
let stdout = io::BufWriter::new(io::stdout());
|
let stdout = io::stdout();
|
||||||
Box::new(NoColorTerminal::new(stdout))
|
Box::new(NoColorTerminal::new(stdout)) as StdoutTerminal
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a terminal that supports color if available.
|
/// Gets a terminal that supports color if available.
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
fn term_stdout(color: bool) -> StdoutTerminal {
|
fn term_stdout(color: bool) -> StdoutTerminal {
|
||||||
let stdout = io::BufWriter::new(io::stdout());
|
let stdout = io::stdout();
|
||||||
if !color || TERMINFO.is_none() {
|
if !color || TERMINFO.is_none() {
|
||||||
Box::new(NoColorTerminal::new(stdout))
|
Box::new(NoColorTerminal::new(stdout))
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user