You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great idea. In general --json should already work with rga, same as with ripgrep. The only issue is that both the inner filenames (e.g. hello.txt within a .zip file) as well as the line number prefix (e.g. Page XYZ in a pdf) will appear within the search result instead of as metadata in the json object.
Off the top of my head, I'm not sure if this is easily possible to create cleanly since ripgrep doesn't have any method for passing a side-channel of metadata through the preprocessing process.
One method would be to insert the metadata into the results stream directly in rga-preproc, then postprocess the output of rg --json in rga and extract that metadata again. That would be pretty hacky though, so I'm not sure if I'd want to do it.
Potentially the best we could do is to output json-in-json (like {"foo":"{\\"foo\\":\\"bar\\"}"}), because ripgrep itself assumes textual output of the preprocessors. Not very satisfying..
I built a web interface for
rg
which works by shelling out to arg --json
process. Here's a demo: https://ripgrep.datasette.io/-/ripgrep?pattern=%22sqlite-utils%5B%22%3E%5D&glob=setup.pyIt would be neat to be able to use this with
rga
as well. Any plans to add arga --json
flag similar to the one inrg
?The text was updated successfully, but these errors were encountered: