beyondgrep/ack1

Arguments should override .ackrc

Closed this issue · 4 comments

dtb commented

I think arguments passed on the shell should override options set in .ackrc. For example, in my .ackrc, I have -a, but if i run ack --css, it should only search css files.

Many arguments do override other arguments, but --type will not override -a.

-a was never intended to be put into your .ackrc, or used as a default of any kind.

In ack 2.0, the behavior that you're looking for (search everything that's a text file by default) will be standard.

dtb commented

Can you suggest a workaround for my use case? Normally, I want to search in all file types under my source tree (hence -a in my ackrc), but occasionally I want to search a specific type. Is there a better way to achieve this?

Don't include -a. -a doesn't mean "all file types", it means "All files, even if they are an unidentified type."

The key is that ack 1.x only searches files of types it recognizes. If it does't know what type the file is, then ack ignores the file. -a gets around that and says "Search even if I don't know what file type it is."

Use the -f flag to see what files ack will search, as in.

ack --css -f