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

[search] nimgrep option --machine_readable to allow integrating with other tools #7428

Closed
timotheecour opened this issue Mar 28, 2018 · 2 comments

Comments

@timotheecour
Copy link
Member

timotheecour commented Mar 28, 2018

I'd like to have an nimgrep option --machine_readable to be easily parsable by a program, eg:

file:line:col:nb_bytes_match:match:nb_bytes_line:line

which would print results 1 per line with all available context, eg:

lib/system.nim:1586:3:4:repr:100:*[T](x: T): string {.magic: "Repr", noSideEffect.}

currently it's tricky to use (and filter results via grep) because the context (file) is not shown in each line, eg:

lib/system.nim
  1586: proc repr*[T](x: T): string {.magic: "Repr", noSideEffect.}
  1586: proc repr*[T](x: T): string {.magic: "Repr", noSideEffect.}

so it's hard to filter via cmd line eg grep.

this would enable something like:

nimgrep -w --machine_readable --ignoreStyle "$1" **/*.nim| grep -E '\b(iterator|proc|template|macro) '

links

#7419

@timotheecour timotheecour changed the title nimgrep option machine_readable nimgrep option --machine_readable to allow integrating with other tools Mar 28, 2018
@Araq
Copy link
Member

Araq commented Mar 28, 2018

We have nimsuggest for editor integration.

@timotheecour timotheecour changed the title nimgrep option --machine_readable to allow integrating with other tools [search] nimgrep option --machine_readable to allow integrating with other tools Aug 1, 2018
@Araq
Copy link
Member

Araq commented Sep 2, 2018

This was implemented with --oneline.

@Araq Araq closed this as completed Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants