"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "crates/cli/src/lib.rs" between
ripgrep-12.1.1.tar.gz and ripgrep-13.0.0.tar.gz

About: ripgrep is a command line search tool ("rg") that tries to combine the usability of "ag" (an "ack" clone) with the raw speed of GNU "grep" (written in "Rust").

lib.rs  (ripgrep-12.1.1):lib.rs  (ripgrep-13.0.0)
skipping to change at line 155 skipping to change at line 155
The The
[`parse_human_readable_size`](fn.parse_human_readable_size.html) [`parse_human_readable_size`](fn.parse_human_readable_size.html)
routine parses strings like `2M` and converts them to the corresponding number routine parses strings like `2M` and converts them to the corresponding number
of bytes (`2 * 1<<20` in this case). If an invalid size is found, then a good of bytes (`2 * 1<<20` in this case). If an invalid size is found, then a good
error message is crafted that typically tells the user how to fix the problem. error message is crafted that typically tells the user how to fix the problem.
*/ */
#![deny(missing_docs)] #![deny(missing_docs)]
extern crate atty;
extern crate bstr;
extern crate globset;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate regex;
extern crate same_file;
extern crate termcolor;
#[cfg(windows)]
extern crate winapi_util;
mod decompress; mod decompress;
mod escape; mod escape;
mod human; mod human;
mod pattern; mod pattern;
mod process; mod process;
mod wtr; mod wtr;
pub use decompress::{ pub use crate::decompress::{
DecompressionMatcher, DecompressionMatcherBuilder, DecompressionReader, resolve_binary, DecompressionMatcher, DecompressionMatcherBuilder,
DecompressionReaderBuilder, DecompressionReader, DecompressionReaderBuilder,
}; };
pub use escape::{escape, escape_os, unescape, unescape_os}; pub use crate::escape::{escape, escape_os, unescape, unescape_os};
pub use human::{parse_human_readable_size, ParseSizeError}; pub use crate::human::{parse_human_readable_size, ParseSizeError};
pub use pattern::{ pub use crate::pattern::{
pattern_from_bytes, pattern_from_os, patterns_from_path, pattern_from_bytes, pattern_from_os, patterns_from_path,
patterns_from_reader, patterns_from_stdin, InvalidPatternError, patterns_from_reader, patterns_from_stdin, InvalidPatternError,
}; };
pub use process::{CommandError, CommandReader, CommandReaderBuilder}; pub use crate::process::{CommandError, CommandReader, CommandReaderBuilder};
pub use wtr::{ pub use crate::wtr::{
stdout, stdout_buffered_block, stdout_buffered_line, StandardStream, stdout, stdout_buffered_block, stdout_buffered_line, StandardStream,
}; };
/// Returns true if and only if stdin is believed to be readable. /// Returns true if and only if stdin is believed to be readable.
/// ///
/// When stdin is readable, command line programs may choose to behave /// When stdin is readable, command line programs may choose to behave
/// differently than when stdin is not readable. For example, `command foo` /// differently than when stdin is not readable. For example, `command foo`
/// might search the current directory for occurrences of `foo` where as /// might search the current directory for occurrences of `foo` where as
/// `command foo < some-file` or `cat some-file | command foo` might instead /// `command foo < some-file` or `cat some-file | command foo` might instead
/// only search stdin for occurrences of `foo`. /// only search stdin for occurrences of `foo`.
pub fn is_readable_stdin() -> bool { pub fn is_readable_stdin() -> bool {
#[cfg(unix)] #[cfg(unix)]
fn imp() -> bool { fn imp() -> bool {
use same_file::Handle; use same_file::Handle;
use std::os::unix::fs::FileTypeExt; use std::os::unix::fs::FileTypeExt;
let ft = match Handle::stdin().and_then(|h| h.as_file().metadata()) { let ft = match Handle::stdin().and_then(|h| h.as_file().metadata()) {
Err(_) => return false, Err(_) => return false,
Ok(md) => md.file_type(), Ok(md) => md.file_type(),
}; };
ft.is_file() || ft.is_fifo() ft.is_file() || ft.is_fifo() || ft.is_socket()
} }
#[cfg(windows)] #[cfg(windows)]
fn imp() -> bool { fn imp() -> bool {
use winapi_util as winutil; use winapi_util as winutil;
winutil::file::typ(winutil::HandleRef::stdin()) winutil::file::typ(winutil::HandleRef::stdin())
.map(|t| t.is_disk() || t.is_pipe()) .map(|t| t.is_disk() || t.is_pipe())
.unwrap_or(false) .unwrap_or(false)
} }
 End of changes. 5 change blocks. 
22 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)