diff --git a/Cargo.lock b/Cargo.lock index 33a99a1..b0cb1b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -903,7 +903,7 @@ dependencies = [ ] [[package]] -name = "rga" +name = "ripgrep_all" version = "0.5.1" dependencies = [ "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index c222bf1..c07be7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "rga" +name = "ripgrep_all" description = "ripgrep but search in PDFs, E-Books, Office documents, etc, and also in archives" license = "AGPL-3.0-or-later" version = "0.5.1" @@ -39,5 +39,5 @@ encoding_rs = "0.8.17" encoding_rs_io = "0.1.6" rusqlite = { version = "0.18.0", features=["vtab"] } # "bundled" size_format = "1.0.2" -structopt = "0.2.17" +structopt = "0.2.16" paste = "0.1.5" diff --git a/README.md b/README.md index d62e879..2de8fe9 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,17 @@ similar: -- pdfgrep -- https://gist.github.com/ColonolBuendia/314826e37ec35c616d70506c38dc65aa +- pdfgrep +- https://gist.github.com/ColonolBuendia/314826e37ec35c616d70506c38dc65aa # todo -- jpg adapter (based on object classification / detection (yolo?)) for fun +- jpg adapter (based on object classification / detection (yolo?)) for fun +- 7z adapter (couldn't find a nice to use rust library) # considerations -- matching on mime (magic bytes) instead of filename -- allow per-adapter configuration options +- matching on mime (magic bytes) instead of filename +- allow per-adapter configuration options # Development @@ -20,3 +21,5 @@ To enable debug logging: export RUST_LOG=rga=debug export RUST_BACKTRACE=1 ``` + +Also rember to disable caching with `--rga-no-cache` or clear the cache in `~/.cache/rga` to debug the adapters. diff --git a/exampledir/test.tar.bz2 b/exampledir/test.tar.bz2 new file mode 100644 index 0000000..16142cf Binary files /dev/null and b/exampledir/test.tar.bz2 differ diff --git a/exampledir/test.tar.gz b/exampledir/test.tar.gz deleted file mode 100644 index cb6159a..0000000 Binary files a/exampledir/test.tar.gz and /dev/null differ diff --git a/src/adapters/tar.rs b/src/adapters/tar.rs index aae2190..942e5f4 100644 --- a/src/adapters/tar.rs +++ b/src/adapters/tar.rs @@ -68,14 +68,14 @@ impl FileAdapter for TarAdapter { let mut archive = ::tar::Archive::new(decompress); for entry in archive.entries()? { let mut file = entry.unwrap(); - let path = PathBuf::from(file.path()?.to_owned()); - eprintln!( - "{}|{}: {} bytes", - filepath_hint.display(), - path.display(), - file.header().size()?, - ); if Regular == file.header().entry_type() { + let path = PathBuf::from(file.path()?.to_owned()); + eprintln!( + "{}|{}: {} bytes", + filepath_hint.display(), + path.display(), + file.header().size()?, + ); let line_prefix = &format!("{}{}: ", line_prefix, path.display()); let ai2: AdaptInfo = AdaptInfo { filepath_hint: &path, diff --git a/src/bin/rga-preproc.rs b/src/bin/rga-preproc.rs index f1b9356..e0258a8 100644 --- a/src/bin/rga-preproc.rs +++ b/src/bin/rga-preproc.rs @@ -1,7 +1,7 @@ use failure::{format_err, Fallible}; - use rga::adapters::*; use rga::preproc::*; +use ripgrep_all as rga; use std::fs::File; diff --git a/src/bin/rga.rs b/src/bin/rga.rs index 4166c7f..234179a 100644 --- a/src/bin/rga.rs +++ b/src/bin/rga.rs @@ -1,8 +1,8 @@ use failure::Fallible; - use rga::adapters::spawning::map_exe_error; use rga::adapters::*; use rga::args::*; +use ripgrep_all as rga; use std::process::Command;