File tree Expand file tree Collapse file tree 5 files changed +19
-11
lines changed
Expand file tree Collapse file tree 5 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " grip-grab"
3- version = " 0.4.1 "
3+ version = " 0.5.3 "
44edition = " 2021"
55authors = [" Alexandre Pasmantier <alex.pasmant@gmail.com>" ]
66license = " Apache-2.0"
Original file line number Diff line number Diff line change 22
33# grip-grab (` gg ` ) 🧤
44
5- A faster , more lightweight ripgrep alternative for day to day usecases .
5+ A fast , more lightweight ripgrep alternative for daily use cases .
66
77``` sh
88❯ gg " \b(Read|Write)Half[^<]" tokio/src
99```
1010
11- https://github.com/user-attachments/assets/0bce247c-7a03-4f62-a29f-51da3c6a54b8
11+
12+
13+ https://github.com/user-attachments/assets/13406bea-b6f2-4629-b814-366713a8d90d
14+
15+
1216
1317
1418
@@ -233,7 +237,7 @@ https://github.com/user-attachments/assets/8620a805-4b2a-498e-a0a0-e8b6835bc9cd
233237``` sh
234238❯ gg " \b(Read|Write)Half[^<]" tokio/src
235239```
236- <img width =" 1973 " alt =" Screenshot 2024-07-26 at 14 00 31 " src =" https://github.com/user-attachments/assets/78d408a2-9f00-4c6d-95c0-6af6211ab40d " >
240+ <img width =" 1838 " alt =" Screenshot 2024-10-04 at 14 48 44 " src =" https://github.com/user-attachments/assets/7ef9fecf-4a00-4be1-90bc-8579e49bced2 " >
237241
238242
239243### JSON output
@@ -248,7 +252,8 @@ https://github.com/user-attachments/assets/8620a805-4b2a-498e-a0a0-e8b6835bc9cd
248252``` sh
249253❯ gg -f " \b(Read|Write)Half[^<]" tokio/src
250254```
251- <img width =" 1713 " alt =" Screenshot 2024-07-24 at 13 29 52 " src =" https://github.com/user-attachments/assets/9e5f5cee-218e-4213-bfeb-25df3d5a2a9e " >
255+ <img width =" 684 " alt =" Screenshot 2024-10-04 at 14 49 44 " src =" https://github.com/user-attachments/assets/150006c9-7ba9-42a9-8d6c-ef46fde39ede " >
256+
252257
253258## Notes
254259This lightweight utility is largely based on a couple of crates from the extraordinary [ ripgrep] ( https://github.com/BurntSushi/ripgrep ) tool.
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ pub fn main() -> anyhow::Result<()> {
5656 path : PathBuf :: from ( "stdin" ) ,
5757 results : search_results,
5858 } ) ?;
59- printer. print ( ) ?;
59+ printer. wipeout ( ) ?;
6060 }
6161 Err ( err) => {
6262 eprintln ! ( "Error: {}" , err) ;
@@ -118,9 +118,8 @@ pub fn main() -> anyhow::Result<()> {
118118
119119 while let Ok ( result) = printer_queue. recv ( ) {
120120 printer. write ( result) ?;
121- printer. print ( ) ?;
122121 }
123122
124- // printer.print ()?;
123+ printer. wipeout ( ) ?;
125124 Ok ( ( ) )
126125}
Original file line number Diff line number Diff line change @@ -98,8 +98,12 @@ impl ResultsPrinter {
9898 }
9999 }
100100
101+ const MAX_BUFFER_SIZE : usize = 1024 ;
102+
101103 pub fn write ( & mut self , results : FileResults ) -> Result < ( ) > {
102- // path = results.path.strip_prefix(self.cwd.clone()).unwrap();
104+ if self . buffer . len ( ) > Self :: MAX_BUFFER_SIZE {
105+ self . buffer . flush ( ) ?;
106+ }
103107 match self . config . mode {
104108 PrintMode :: Text => self . write_colored_text_results ( & results. path , results. results ) ,
105109 PrintMode :: Json => self . writeln_to_buffer ( serde_json:: to_string ( & FileResults {
@@ -195,7 +199,7 @@ impl ResultsPrinter {
195199 writeln ! ( self . buffer, "" )
196200 }
197201
198- pub fn print ( & mut self ) -> Result < ( ) > {
202+ pub fn wipeout ( & mut self ) -> Result < ( ) > {
199203 self . buffer . flush ( ) ?;
200204 self . reset_ansi_formatting ( )
201205 }
You can’t perform that action at this time.
0 commit comments