Search code examples
sconsack

Add SCons files to ack searches


I love the code search utility ack. It is smart enough to look through Makefiles, but doesn't know about the SConstruct and SConscript files that scons uses. How do I add those to the files that ack will look in?


Solution

  • This can't be done using ack's type sets. Makefiles and Rakefiles are hard-coded in the source. I thought you could add a scons type by modifying $HOME/.ackrc and adding --type-set=scons=SConstruct,SConscript, but that will search for a file that ends in ".SConstruct" or ".SConscript".

    The easiest workaround is to add the -a (all file types) flag to ack.

    If you just want ack to search and be able to filter the SConstruct somehow, then you could add #!/usr/bin/python as the first line of the SConstruct file. Ack will then treat the file as python source code, and you can filter with --python.