-- Leo's gemini proxy

-- Connecting to idiomdrottning.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

mg — Muine-style Grep


Kinda always thought it was weird that Unix didn’t have an app that could search for files where multiple patterns matched.


The patterns shouldn’t have to be on the same lines, but each term needs to be in the file.


This li’l twelve line Chicken Scheme program does just that.


git clone https://idiomdrottning.org/mg

I didn’t feel like implementing a buncha regex engines and stuff so I just shell out to rg -li, you can change that to ag, or traditional grep or awk or whatever you want before compiling.


This first version doesn’t have any options. The last argument is a directory of files (just use . if you want current directory, you’ve got to put something) and every other argument is a search pattern.


The last arg needs to be a directory and not a glob—that’ll get interpreted as if it were a search pattern.


Maybe in the future I’ll add some options handling and more awareness around paths and files to search in. This is just a quick li’l first^W second release.♥


Thanks to jcowan for writing in with the idea that instead of searching all the files once per term and lset-intersecting them, I could instead keep on narrowing the search. Obvi in hindsight and now implemented♥

-- Response ended

-- Page fetched on Thu Mar 28 21:56:44 2024