Limiting silver-searcher to only search specific file types

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 Answer

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

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like