I am just looking for an example ( the correct command to fire in the advance search at github ) about searching a word inside a folder of a particular repository. I guess this will involve the "path:" option but not sure how to use it
As an example I need to search for a function name "clean" or a test case for "clean" or similar function inside the jquery test suite at the following location -
https://github.com/jquery/jquery/tree/master/test
I understand there are some filters like repo: and path: provided by github but not sure how to use them.
Also I am not satisfied with an answer posted for a similar question at - Search a github repository for the file defining a given function
I understand I can fork it to my local machine and do a search there but I don't want to download the whole repository simply to search it. I just need to search it online at the github site itself.
Thanks in advance !!
Select to search in current repository, not "All GitHub". It will display all "Entry" in particular file. Just to add a little something: the syntax seems to be <search term> filename:<filename> and you may search for it in your organization only (by adding org:<your organization name> .
Finding all references of a function or method You can find all references for a function or method within the same repository by clicking the function or method call in a file, then clicking the References tab.
I get 41 result with this query.
The key is to specify the user/reponame, not the the reponame:
repo:hadley/ggplot2
Combined with wildcard for the path argument, I select only one argument with this query:
repo:hadley/ggplot2 facet_wrap path:inst/*.r
So, for path, the key is to add a wildcard (which doesn't seem to be documented anywhere).path:inst/
alone won't work. path:*
or path:*.r
will.
From the comments:
I need to find "
beforeSend
" entry which is in this file - "jquery / test / unit / ajax.js
" atgithub.com/jquery/jquery/blob/master/test/unit/ajax.js
but when I firerepo:jeresig/jquery beforeSend path:jquery/test/unit*.js
in the advance search I don't get any results.
I am also confused which user should I use as jquery has many contributors like John Resig, timmywil
In this case:
jquery/jquery
(no need for a username here)path:
directive to use must not repeat the repo name: so, path:test/unit*.js
, not path:jquery/test/unit*.js
repo:jquery/jquery beforeSend path:test/unit*.js
will work, and provide 4 results within JQuery Code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With