beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**

Home Page:https://github.com/beyondgrep/ack3/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

-s option has no effect when -x option is used

kawing-chiu opened this issue · comments

I'm using ack 2.24. According to the doc, -s should suppress error messages about nonexistent files etc. However, when file list is read from stdin, it does not work:

$ ack -s some_pattern not_exist
$ echo not_exist | ack -s -x some_pattern
ack: not_exist: No such file

That's frustrating. :-/ Thanks for reporting it.

But I'm glad to see folks using the -x switch!

Thanks for the prompt reply! For the time being, here's a workaround I use:

$ echo not_exist | xargs ls -d 2>/dev/null | ack -x some_pattern

I'll fix it in ack itself. I don't think it will be that big of a deal.

While I have your attention, can you tell me more about how you're using -x? I rarely see people mention it, and it's one of my favorite features. Did you just stumble across it in the docs and think "Hey, that's handy"?

Ack is my choice of vim's grepprg. I use the -x option so that I can use other program to narrow down what to search first. In a large project, searching directly on a raw directory is infeasible. For example, my python project has a lot of cython-generated .c files in the src directory that I never want to touch. So my grepprg looks like:

let &grepprg = 'git ls-files -co --exclude-standard -z \| xargs -0 ls -d 2>/dev/null \| ack -x'

I do similar thing to other search-related plugins like ctrl-p, too. Don't know whether this is the correct way, though.

This has been fixed in ack3. There will be no more releases of ack 2.