mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-06-30 22:23:44 +02:00
search: add support for searching compressed files
This commit adds opt-in support for searching compressed files during recursive search. This behavior is only enabled when the `-z/--search-zip` flag is passed to ripgrep. When enabled, a limited set of common compression formats are recognized via file extension, and a new process is spawned to perform the decompression. ripgrep then searches the stdout of that spawned process. Closes #539
This commit is contained in:
committed by
Andrew Gallant
parent
a8543f798d
commit
f007f940c5
14
src/app.rs
14
src/app.rs
@ -191,6 +191,7 @@ pub fn app() -> App<'static, 'static> {
|
||||
.arg(flag("type-clear")
|
||||
.value_name("TYPE").takes_value(true)
|
||||
.multiple(true).number_of_values(1))
|
||||
.arg(flag("search-zip").short("z"))
|
||||
}
|
||||
|
||||
struct Usage {
|
||||
@ -450,7 +451,8 @@ lazy_static! {
|
||||
can be specified by using the --ignore-file flag several times. \
|
||||
When specifying multiple ignore files, earlier files have lower \
|
||||
precedence than later files. If you are looking for a way to \
|
||||
include or exclude files and directories directly used -g instead.");
|
||||
include or exclude files and directories directly used -g \
|
||||
instead.");
|
||||
doc!(h, "follow",
|
||||
"Follow symbolic links.");
|
||||
doc!(h, "max-count",
|
||||
@ -592,6 +594,11 @@ lazy_static! {
|
||||
only clears the default type definitions that are found inside \
|
||||
of ripgrep.\n\nNote that this MUST be passed to every \
|
||||
invocation of ripgrep. Type settings are NOT persisted.");
|
||||
doc!(h, "search-zip",
|
||||
"Search in compressed files.",
|
||||
"Search in compressed files. Currently gz, bz2, xz, and \
|
||||
lzma files are supported. This option expects the decompression \
|
||||
binaries to be available in the system PATH.");
|
||||
|
||||
h
|
||||
};
|
||||
@ -599,8 +606,9 @@ lazy_static! {
|
||||
|
||||
fn validate_line_number_width(s: String) -> Result<(), String> {
|
||||
if s.starts_with("0") {
|
||||
Err(String::from("Custom padding characters are currently not supported. \
|
||||
Please enter only a numeric value."))
|
||||
Err(String::from(
|
||||
"Custom padding characters are currently not supported. \
|
||||
Please enter only a numeric value."))
|
||||
} else {
|
||||
validate_number(s)
|
||||
}
|
||||
|
Reference in New Issue
Block a user