chore: bump version
This commit is contained in:
parent
df4d56a067
commit
c79886354c
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -275,7 +275,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "grip-grab"
|
||||
version = "0.4.1"
|
||||
version = "0.5.3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "grip-grab"
|
||||
version = "0.4.1"
|
||||
version = "0.5.3"
|
||||
edition = "2021"
|
||||
authors = ["Alexandre Pasmantier <alex.pasmant@gmail.com>"]
|
||||
license = "Apache-2.0"
|
||||
|
13
README.md
13
README.md
@ -2,13 +2,17 @@
|
||||
|
||||
# grip-grab (`gg`) 🧤
|
||||
|
||||
A faster, more lightweight ripgrep alternative for day to day usecases.
|
||||
A fast, more lightweight ripgrep alternative for daily use cases.
|
||||
|
||||
```sh
|
||||
❯ gg "\b(Read|Write)Half[^<]" tokio/src
|
||||
```
|
||||
|
||||
https://github.com/user-attachments/assets/0bce247c-7a03-4f62-a29f-51da3c6a54b8
|
||||
|
||||
|
||||
https://github.com/user-attachments/assets/13406bea-b6f2-4629-b814-366713a8d90d
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -233,7 +237,7 @@ https://github.com/user-attachments/assets/8620a805-4b2a-498e-a0a0-e8b6835bc9cd
|
||||
```sh
|
||||
❯ gg "\b(Read|Write)Half[^<]" tokio/src
|
||||
```
|
||||
<img width="1973" alt="Screenshot 2024-07-26 at 14 00 31" src="https://github.com/user-attachments/assets/78d408a2-9f00-4c6d-95c0-6af6211ab40d">
|
||||
<img width="1838" alt="Screenshot 2024-10-04 at 14 48 44" src="https://github.com/user-attachments/assets/7ef9fecf-4a00-4be1-90bc-8579e49bced2">
|
||||
|
||||
|
||||
### JSON output
|
||||
@ -248,7 +252,8 @@ https://github.com/user-attachments/assets/8620a805-4b2a-498e-a0a0-e8b6835bc9cd
|
||||
```sh
|
||||
❯ gg -f "\b(Read|Write)Half[^<]" tokio/src
|
||||
```
|
||||
<img width="1713" alt="Screenshot 2024-07-24 at 13 29 52" src="https://github.com/user-attachments/assets/9e5f5cee-218e-4213-bfeb-25df3d5a2a9e">
|
||||
<img width="684" alt="Screenshot 2024-10-04 at 14 49 44" src="https://github.com/user-attachments/assets/150006c9-7ba9-42a9-8d6c-ef46fde39ede">
|
||||
|
||||
|
||||
## Notes
|
||||
This lightweight utility is largely based on a couple of crates from the extraordinary [ripgrep](https://github.com/BurntSushi/ripgrep) tool.
|
||||
|
@ -56,7 +56,7 @@ pub fn main() -> anyhow::Result<()> {
|
||||
path: PathBuf::from("stdin"),
|
||||
results: search_results,
|
||||
})?;
|
||||
printer.print()?;
|
||||
printer.wipeout()?;
|
||||
}
|
||||
Err(err) => {
|
||||
eprintln!("Error: {}", err);
|
||||
@ -118,9 +118,8 @@ pub fn main() -> anyhow::Result<()> {
|
||||
|
||||
while let Ok(result) = printer_queue.recv() {
|
||||
printer.write(result)?;
|
||||
printer.print()?;
|
||||
}
|
||||
|
||||
//printer.print()?;
|
||||
printer.wipeout()?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -98,8 +98,12 @@ impl ResultsPrinter {
|
||||
}
|
||||
}
|
||||
|
||||
const MAX_BUFFER_SIZE: usize = 1024;
|
||||
|
||||
pub fn write(&mut self, results: FileResults) -> Result<()> {
|
||||
// path = results.path.strip_prefix(self.cwd.clone()).unwrap();
|
||||
if self.buffer.len() > Self::MAX_BUFFER_SIZE {
|
||||
self.buffer.flush()?;
|
||||
}
|
||||
match self.config.mode {
|
||||
PrintMode::Text => self.write_colored_text_results(&results.path, results.results),
|
||||
PrintMode::Json => self.writeln_to_buffer(serde_json::to_string(&FileResults {
|
||||
@ -195,7 +199,7 @@ impl ResultsPrinter {
|
||||
writeln!(self.buffer, "")
|
||||
}
|
||||
|
||||
pub fn print(&mut self) -> Result<()> {
|
||||
pub fn wipeout(&mut self) -> Result<()> {
|
||||
self.buffer.flush()?;
|
||||
self.reset_ansi_formatting()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user