سؤال

I'm using ack to search through all source files including .c, .cpp, .h and another propriety format (lets call it .abc) and I've found that the following works fine:

ack --type-add cc=abc text_to_look_for

Which allows ack to treat .abc files as C/C++ style. However, I thought it would be nice to add this setting into a resource file .ackrc in my home directory:

$ cat ~/.ackrc
--type-add cc=abc

This all seems reasonable and fits in with what's written in the man page as far as I can see. However, when I no do

ack text_to_look_for

I get the following error message which implies that the option I'm using is not supported.

$ ack text_to_look_for
Unknown option: type-add cc
ack: See ack --help or ack --man for options.

Can anyone see what I'm doing wrong here? I'm using ack version 1.84 on Solaris 10. Unfortunately, upgrading is not an option, but it would be nice to know if it's a bug or just me doing something wrong.

هل كانت مفيدة؟

المحلول

It has to be --type-add=cc=abc. Here's an excerpt from my .ackrc

# Handle .md files
--type-set=md=.mkd
--type-add=md=.md
# Handle .textile files
--type-set=textile=.textile
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top