If I understand correctly (from Defining your own types in ack --man
), when I use --type-set
in .ackrc
(or at the command line) I can only use one "filtertype". In my case, I'd like to match files with a particular extension that also have a pattern present in the first line. I imagined it would look like this (perhaps without the --type-set
in the middle:
--type-set
mytype:firstlinematch:my.regex.pattern...
--type-set
mytype:ext:myextension
If I do that, though, the linematch is ignored, because the type is replaced by the 2nd entry.*
I know multiple entries are allowed for --type-add
, but that means this OR that condition must be true, rather than restricting to when both are true.
Is there a way to narrow using two filter types for a case like this?
- (If I'm right about that, then a warning would help when a definition is clobbered later in
.ackrc
.)