Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

machine interface #462

Closed
albfan opened this issue Apr 27, 2017 · 5 comments
Closed

machine interface #462

albfan opened this issue Apr 27, 2017 · 5 comments

Comments

@albfan
Copy link

albfan commented Apr 27, 2017

Hi, I'm the maintainer of https://github.com/albfan/ag.vim

Someone ask me to integrate with rg, and after trying it is sensibly faster than ag so want to ask if it's possible to add an option to expose results in a parseable way ready for machines.

By now I'm parsing filename, column, line and contents from --group option so this is not a stopper, but would be great to offer results that way to ease maintenance and complex features like hightlight code

Maybe --porceain could be a great name for option. Anything will work

@kpp
Copy link
Contributor

kpp commented Apr 27, 2017

How about existing --vimgrep?

@tiehuis
Copy link
Contributor

tiehuis commented Apr 27, 2017

#244 is related. May be worthwhile to see if what is outlined there differs from your requirements.

@albfan
Copy link
Author

albfan commented Apr 27, 2017

I use mostly search with context:

$ rg foo -C4

Those contexts lines are really useful, so I really work on AgGroup (not the commands related with quicklist). Parsing results with context slows the interaction and is error prone

@tiehuis That would help to highlight without reprocess regex (with the escape characters hell)

Deterministic results like:

file: foo
   - matches: [
        {
            line: 1,
            col: 10,
            match: foo,
            before: 3,
            after: 4,
            result: "asdfasdfasdf
asdfsadfasdf
foo
asfasdfasdf
"         
 },
...
]

etc etc woud be great as there's lot of info rg knows but do not expose (reflected in highlights for example)

@tiehuis
Copy link
Contributor

tiehuis commented Apr 27, 2017

Just to add, here (#359) was a similar issue regarding structured output (which looks very much the same as what you are suggesting) and a response from BurntSushi.

@albfan
Copy link
Author

albfan commented Apr 27, 2017

@tiehuis Thanks that's exactly what I need.

I was afraid to ask for a library, but seems there's a work in progress. That's perfect for another idea I have for rg (use on gnome builder as a global search albfan/gnome-builder#14)

Then we need to contribute on rg library. That makes sense, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants