BrianHicks / tree-grepper

Like grep, but uses tree-sitter grammars to search
Other
290 stars 20 forks source link

tree-grepper seems to ignore the PATHS parameter #455

Closed rtfb closed 4 months ago

rtfb commented 4 months ago

If I run it like this:

$ tree-grepper -q c '(translation_unit (declaration) @decl)' src/

I get results from all subdirectories, as if it used the default . value for PATHS.

When I specify more than one path, it complains in a way that seems to indicate it might be misinterpreting the PATHS arguments altogether:

$ tree-grepper -q c '(translation_unit (declaration) @decl)' src/ include/
couldn't get a valid configuration from the command-line options

Caused by:
    0: could not parse language
    1: unknown language src/. Try one of: c, cpp, cuda, elixir, elm, go, haskell, java, javascript, markdown, nix, php, python, ruby, rust, sass, typescript

Is this a bug or am I perhaps using it somehow wrong? I'm using a local build from the latest main.

BrianHicks commented 4 months ago

yes, that's bug (#355 to be precise.)

The proposal at some point will be to do this better with #436

I'm going to close this as a duplicate for now, but thank you for reporting it, and sorry for the bad experience!

rtfb commented 4 months ago

Thanks for a quick response, @BrianHicks!

Yeah, I saw #355 before reporting, but not knowing the internals it was difficult to recognize as the same problem.