beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 140 forks source link

--type-add=module:match:/node_modules/ should work. #440

Closed idearat closed 5 years ago

idearat commented 10 years ago

You can't create "type" filters that work on the full path, they only appear to work on the filename itself. Unfortunately this means you can't categorize files into types based on where they reside in your project. So you can't make a file type "test" for all files under a test dir, or "module" for all files under your node_modules directory. This would let you then search with a --type=nomodule or --type=notest but that currently doesn't work. Yes, you can --ignore-dir, but I think using pattern matching is more powerful and flexible.

hoelzro commented 10 years ago

@idearat This is an interesting idea, but how would this behave if you weren't at the project root? Let's say I'm in $ROOT/app/controllers and I do an ack --module something; how should that behave?

idearat commented 10 years ago

I don't expect ack to behave differently than it normally would in the sense I'd expect things to default to the current directory but offer the option of rooting the search elsewhere. It's simple enough to create aliases to push/pop a project root if that were consistently an issue within a project subtree.