29

I'm doing ag "active_record" ., but I want to only care about .rb files.

How do I limit what file types it searches on the command line?

1 Answers1

38

Succintly,

ag active_record --ruby

Also you can use:

ag --list-file-types to list the supported file types

Otherwise you can limit by extension (also for unknown filetypes) by providing a regex as follows:

ag -G'\.rb$' active_record

Edited due to correction by bobbaluba

Luke H
  • 566