2

Ack isn't searching my .hamstache files. How do I get it included in searches?

My .ackrc file looks like this:

--type-add
ruby=haml

--type-add
ruby=slim

--type-add
js=.coffee

--type-set
coffee=.coffee

--type-add
haml=hamstache

When I run a search on the project I get this message:

ack: --type-add: Type "haml" does not exist, creating with "hamstache" ...
daxelrod
  • 2,499
  • 1
  • 22
  • 30
AdamT
  • 6,405
  • 10
  • 49
  • 75

2 Answers2

1

The warning is just a warning, not an error. You can safely ignore it.

--type-add is for adding to an extension that already exists. You want --type-set for the first time you specify an extension for a filetype.

Be careful with --type-set, though, because it will overwrite whatever is set. For example, if you do --type-set=ruby=.rubytest, then then only extension ack will recognize is .rubytest.

ack 2.0 (in alpha) has a debug option to make this easier and clearer to debug.

Andy Lester
  • 91,102
  • 13
  • 100
  • 152
  • How would you deal with potential future releases of ack that add new file types, without getting the warning and without overwriting them? –  Apr 16 '14 at 09:14
  • I don't know that there's a solution to that. It's always possible to get updated or new filetypes in future releases of ack. That said, ack 2.0 makes it easier to manage your filetypes. – Andy Lester Apr 16 '14 at 12:23
0

Looks to me like you’re missing the . before the hamstache file extension.

Buck Doyle
  • 6,333
  • 1
  • 22
  • 35