ack: Exclude specific directories from search via regex

后端 未结 4 828
小蘑菇
小蘑菇 2021-02-01 16:31

How do I ignore specific directories via RegEx with ack?

I can use the --ignore-dir option, but this does not let me specify a RegEx. I want to be able to i

4条回答
  •  梦谈多话
    2021-02-01 17:16

    In recent versions of ack, you can use regular expressions with --ignore-dir.

    From this thread:

    Yes, in 2.15_01 we added:

    • ack now supports --ignore-dir=match:.... Thanks, Ailin Nemui! (GitHub ticket #42)

    GitHub link: https://github.com/petdance/ack2/issues/42

    Sadly, I think this only supports matching the base directory name, not the full path.

    For instance, you cannot match a path like ".*/docs/generated/.*" with it.

    For that, see the GitHub issue 291.

    update for 2020: it looks like this is now moved to ack3 (github issue).

提交回复
热议问题