Hacker News new | past | comments | ask | show | jobs | submit login

>I see, you have to do "rg -g '.l' foo"

Actually it's just:

  rg -g '*.js' query
And if it's a known file type, like js, you can do (-t type):

  rg -g -t js
Why force people to put asterisks inside of single quotes on the command line?*

Because else the shell will auto-expand the asterisk before it even gets to rg, and rg will instead get the expanded list of files that match the pattern. E.g. if you have

  a.js b.js /foo
in a folder, then:

  rg -g *.js query
will be expanded by your shell to:

  rg -g a.js b.js query
and THEN run. rg will never see the asterisk in that case (and it also wont search inside /foo).

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact