As discussed between myself and @ggreer: https://news.ycombinator.com/item?id=12568822 Yay cooperation!
Might it also be possible to add a switch like ag's --ignore PATTERN?
Ignore files/directories whose names match this pattern. Literal file and directory names are also allowed.
Sorry - don't mean to hijack this thread; just seemed tangentially related.
rg has it with the -g/--glob flag.
Thanks for the fast response! And sorry for bothering you - I had tried the --glob flag, but had been erroneously placing it before the search term with the other options. After reading your response here, found your detailed blog post with a slew of examples, including just the one I was after:
exclude files matching a particular glob:
$ rg foo -g '!*.min.js'
Strange, the placement of -g (before or after pattern) shouldn't have any effect.
I must apologize again: on closer inspection, the problem was me not enclosing the glob in single quotes. I was doing this sort of thing:
$ rg -t html -g index* _searchterm_
No such file or directory (os error 2)
Ah, yup, that'll do it. The shell takes over there. No worries! Glad you got it straightened out. :-)
Thanks again for the super-fast replies Andrew! And of course, for crafting ripgrep - it is a marvel! Do you accept donations? Or have an Amazon wish list or the like?
@tinyapps Thanks! You're very kind. :-) If you're so inclined, please donate it to a cause you find worthy. (I'd recommend Wikipedia.)
Done! $100 sent to Wikipedia a few moments ago thanks to you and your generosity!
Wow. That's very generous of you! Thank you so much! :-)
No, it is _you_ who is so generous with your time and expertise! And that after having been on the HN front page all day! Cannot thank you enough!
Most helpful comment
Done! $100 sent to Wikipedia a few moments ago thanks to you and your generosity!