mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07:00
parent
9f0e88bcb1
commit
0aa31676e3
@ -382,7 +382,7 @@ impl DecompressionReader {
|
|||||||
///
|
///
|
||||||
/// `close` is also called in `drop` as a last line of defense against
|
/// `close` is also called in `drop` as a last line of defense against
|
||||||
/// resource leakage. Any error from the child process is then printed as a
|
/// resource leakage. Any error from the child process is then printed as a
|
||||||
/// warning to stderr. This can be avoided by explictly calling `close`
|
/// warning to stderr. This can be avoided by explicitly calling `close`
|
||||||
/// before the CommandReader is dropped.
|
/// before the CommandReader is dropped.
|
||||||
pub fn close(&mut self) -> io::Result<()> {
|
pub fn close(&mut self) -> io::Result<()> {
|
||||||
match self.rdr {
|
match self.rdr {
|
||||||
|
@ -212,13 +212,13 @@ pub fn is_readable_stdin() -> bool {
|
|||||||
!is_tty_stdin() && imp()
|
!is_tty_stdin() && imp()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if and only if stdin is believed to be connectted to a tty
|
/// Returns true if and only if stdin is believed to be connected to a tty
|
||||||
/// or a console.
|
/// or a console.
|
||||||
pub fn is_tty_stdin() -> bool {
|
pub fn is_tty_stdin() -> bool {
|
||||||
atty::is(atty::Stream::Stdin)
|
atty::is(atty::Stream::Stdin)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if and only if stdout is believed to be connectted to a tty
|
/// Returns true if and only if stdout is believed to be connected to a tty
|
||||||
/// or a console.
|
/// or a console.
|
||||||
///
|
///
|
||||||
/// This is useful for when you want your command line program to produce
|
/// This is useful for when you want your command line program to produce
|
||||||
@ -230,7 +230,7 @@ pub fn is_tty_stdout() -> bool {
|
|||||||
atty::is(atty::Stream::Stdout)
|
atty::is(atty::Stream::Stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if and only if stderr is believed to be connectted to a tty
|
/// Returns true if and only if stderr is believed to be connected to a tty
|
||||||
/// or a console.
|
/// or a console.
|
||||||
pub fn is_tty_stderr() -> bool {
|
pub fn is_tty_stderr() -> bool {
|
||||||
atty::is(atty::Stream::Stderr)
|
atty::is(atty::Stream::Stderr)
|
||||||
|
@ -221,7 +221,7 @@ impl CommandReader {
|
|||||||
///
|
///
|
||||||
/// `close` is also called in `drop` as a last line of defense against
|
/// `close` is also called in `drop` as a last line of defense against
|
||||||
/// resource leakage. Any error from the child process is then printed as a
|
/// resource leakage. Any error from the child process is then printed as a
|
||||||
/// warning to stderr. This can be avoided by explictly calling `close`
|
/// warning to stderr. This can be avoided by explicitly calling `close`
|
||||||
/// before the CommandReader is dropped.
|
/// before the CommandReader is dropped.
|
||||||
pub fn close(&mut self) -> io::Result<()> {
|
pub fn close(&mut self) -> io::Result<()> {
|
||||||
// Dropping stdout closes the underlying file descriptor, which should
|
// Dropping stdout closes the underlying file descriptor, which should
|
||||||
|
@ -104,7 +104,7 @@ struct ArgsImp {
|
|||||||
///
|
///
|
||||||
/// It's important that this is only built once, since building this goes
|
/// It's important that this is only built once, since building this goes
|
||||||
/// through regex compilation and various types of analyses. That is, if
|
/// through regex compilation and various types of analyses. That is, if
|
||||||
/// you need many of theses (one per thread, for example), it is better to
|
/// you need many of these (one per thread, for example), it is better to
|
||||||
/// build it once and then clone it.
|
/// build it once and then clone it.
|
||||||
matcher: PatternMatcher,
|
matcher: PatternMatcher,
|
||||||
/// The paths provided at the command line. This is guaranteed to be
|
/// The paths provided at the command line. This is guaranteed to be
|
||||||
|
@ -67,7 +67,7 @@ impl SubjectBuilder {
|
|||||||
if subj.is_file() {
|
if subj.is_file() {
|
||||||
return Some(subj);
|
return Some(subj);
|
||||||
}
|
}
|
||||||
// We got nothin. Emit a debug message, but only if this isn't a
|
// We got nothing. Emit a debug message, but only if this isn't a
|
||||||
// directory. Otherwise, emitting messages for directories is just
|
// directory. Otherwise, emitting messages for directories is just
|
||||||
// noisy.
|
// noisy.
|
||||||
if !subj.is_dir() {
|
if !subj.is_dir() {
|
||||||
|
@ -147,7 +147,7 @@ impl JSONBuilder {
|
|||||||
/// is not limited to UTF-8 exclusively, which in turn implies that matches
|
/// is not limited to UTF-8 exclusively, which in turn implies that matches
|
||||||
/// may be reported that contain invalid UTF-8. Moreover, this printer may
|
/// may be reported that contain invalid UTF-8. Moreover, this printer may
|
||||||
/// also print file paths, and the encoding of file paths is itself not
|
/// also print file paths, and the encoding of file paths is itself not
|
||||||
/// guarnateed to be valid UTF-8. Therefore, this printer must deal with the
|
/// guaranteed to be valid UTF-8. Therefore, this printer must deal with the
|
||||||
/// presence of invalid UTF-8 somehow. The printer could silently ignore such
|
/// presence of invalid UTF-8 somehow. The printer could silently ignore such
|
||||||
/// things completely, or even lossily transcode invalid UTF-8 to valid UTF-8
|
/// things completely, or even lossily transcode invalid UTF-8 to valid UTF-8
|
||||||
/// by replacing all invalid sequences with the Unicode replacement character.
|
/// by replacing all invalid sequences with the Unicode replacement character.
|
||||||
|
@ -1594,7 +1594,7 @@ impl<'a, M: Matcher, W: WriteColor> StandardImpl<'a, M, W> {
|
|||||||
/// multiple lines.
|
/// multiple lines.
|
||||||
///
|
///
|
||||||
/// Note that this doesn't just return whether the searcher is in multi
|
/// Note that this doesn't just return whether the searcher is in multi
|
||||||
/// line mode, but also checks if the mater can match over multiple lines.
|
/// line mode, but also checks if the matter can match over multiple lines.
|
||||||
/// If it can't, then we don't need multi line handling, even if the
|
/// If it can't, then we don't need multi line handling, even if the
|
||||||
/// searcher has multi line mode enabled.
|
/// searcher has multi line mode enabled.
|
||||||
fn multi_line(&self) -> bool {
|
fn multi_line(&self) -> bool {
|
||||||
|
@ -508,7 +508,7 @@ impl<'p, 's, M: Matcher, W: WriteColor> SummarySink<'p, 's, M, W> {
|
|||||||
/// multiple lines.
|
/// multiple lines.
|
||||||
///
|
///
|
||||||
/// Note that this doesn't just return whether the searcher is in multi
|
/// Note that this doesn't just return whether the searcher is in multi
|
||||||
/// line mode, but also checks if the mater can match over multiple lines.
|
/// line mode, but also checks if the matter can match over multiple lines.
|
||||||
/// If it can't, then we don't need multi line handling, even if the
|
/// If it can't, then we don't need multi line handling, even if the
|
||||||
/// searcher has multi line mode enabled.
|
/// searcher has multi line mode enabled.
|
||||||
fn multi_line(&self, searcher: &Searcher) -> bool {
|
fn multi_line(&self, searcher: &Searcher) -> bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user