Hacker News new | ask | show | jobs
by 3PS 927 days ago
If you're a fan of the -g flag to ripgrep then I also recommend checking out the -t flag, short for --type, which lets you search specific file types. You can see the full list with `rg --type-list`. For example, you could just search .cs files with `rg -tcs`.

This flag is especially convenient if you want to search e.g. .yml and .yaml in one go, or .c and .h in one go, etc.

2 comments

Thanks, I didn't know about `-t`, I'll read up on it.
-t is useful but -g doesn't require lookup in help first. Maybe the worse is better principle?
Tbh I've always just typed -t followed by something that feels intuitive and it's always worked. Never really bothered looking in help until I made the above comment.