Closed AndrewRayCode closed 7 years ago
@DelvarWorld You're completely right; I don't know if there is a way to do this. --ignore-file
and --ignore-dir
both only act on the last component in a file path (in this case, c.js
), and you said you don't want to ignore other files with the same name, so that's out. Interestingly enough, though, is the fact that -g
regexes apply to the whole path, but --ignore-*
only apply to the last part of a path...
I also find I'm needing this. We have a huge somedir/Makefile
that is autogenerated. I want to search most Makefiles, just not that one.
What I'd like was to be able to put this in .ackrc
:
--ignore-file-path=match:somedir/Makefile$
Ideally it always matches against the full name of the file all the way from /
, similar to Perl's $File::Find::fullname
. So that if I did this, it also ignored ./Makefile
:
$ cd /path/to/somedir
$ ack foobar
But I could easily live with ./Makefile
not being ignored, if ack
only matches against the relative path. I'll run most acks
somewere above somedir
anyway.
This issue was moved to petdance/ack3#43
This will be addressed in ack3.
From http://stackoverflow.com/questions/24815522/how-do-i-make-ack-ignore-a-file-in-a-directory/24824663#24824663
I have a file in a directory
a/b/c.js
I can't ignore
c.js
with--ignore-file=match:c.js
because I want to match other file namedc.js
I can't ignore dir
a/b
with--ignore-dir=a/b
because there are other files I care about ina/b
I've tried:
I've tried:
Doesn't work, and I'm guessing that it's because ack doesn't read the file path as part of the match, just the name.
I've tried:
I can't find anything useful in the Ack manual soup. How do I ignore a file in a directory?