Skip to content

Commit 7578e23

Browse files
authored
Add grep search (#37)
1 parent e1edd26 commit 7578e23

File tree

8 files changed

+57
-8
lines changed

8 files changed

+57
-8
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ BugReports: https://github.com/coatless-rpkg/searcher/issues
2323
Depends: R (>= 3.3.0)
2424
License: GPL (>= 2)
2525
Encoding: UTF-8
26-
RoxygenNote: 7.2.3
26+
RoxygenNote: 7.3.1
2727
Roxygen: list(markdown = TRUE)
2828
Suggests:
2929
testthat (>= 2.1.0),

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export(search_ecosia)
99
export(search_gh)
1010
export(search_github)
1111
export(search_google)
12+
export(search_grep)
1213
export(search_ixquick)
1314
export(search_rscom)
1415
export(search_rseek)

NEWS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# searcher 0.0.7
2+
3+
## Features
4+
5+
- Added search portal:
6+
- `search_grep()`: Searches on grep.app.
7+
([#35](https://github.com/r-assist/searcher/issues/35),
8+
[#37](https://github.com/r-assist/searcher/pull/37))
9+
10+
111
# searcher 0.0.6
212

313
## Features

R/index-sites.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ site_index =
4545
list(
4646
site_entry("google", "https://google.com/search?q="),
4747
site_entry("bing", "https://bing.com/search?q="),
48+
site_entry("grep", "https://grep.app/search?q=",
49+
keywords = keyword_entry("&filter[lang][0]=R")),
4850
site_entry("duckduckgo", "https://duckduckgo.com/?q=", "ddg"),
4951
site_entry("startpage", "https://startpage.com/do/dsearch?query=", "sp"),
5052
site_entry("ecosia", "https://www.ecosia.org/search?q="),

R/search-functions.R

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#' @seealso [search_google()], [search_bing()], [search_duckduckgo()],
1818
#' [search_startpage()], [search_rseek()], [search_twitter()],
1919
#' [search_rstudio_community()], [search_stackoverflow()],
20-
#' [search_github()], [search_bitbucket()], and [searcher()]
20+
#' [search_github()], [search_grep()], [search_bitbucket()], and [searcher()]
2121
#' @examples
2222
#' # Search in a generic way
2323
#' search_site("r-project", "google")
@@ -55,6 +55,12 @@
5555
#' # Search all languages on GitHub Issues for bivariate normal
5656
#' search_github("bivariate normal", rlang = FALSE)
5757
#'
58+
#' # Search R code on GitHub for numerical optimization
59+
#' search_grep("optim")
60+
#'
61+
#' # Search all code on GitHub for numerical optimization
62+
#' search_grep("optim", rlang = FALSE)
63+
#'
5864
#' # Search BitBucket for assertions
5965
#' search_bitbucket("assertions")
6066
#'
@@ -79,6 +85,7 @@ search_site = function(query,
7985
"so",
8086
"github",
8187
"gh",
88+
"grep",
8289
"bitbucket",
8390
"bb"
8491
),
@@ -102,6 +109,7 @@ search_site = function(query,
102109
so = search_stackoverflow(query, rlang),
103110
github = , # empty case carried below
104111
gh = search_github(query, rlang),
112+
grep = search_grep(query, rlang),
105113
bitbucket = , # empty case carried below
106114
bb = search_bitbucket(query, rlang)
107115
)
@@ -295,6 +303,14 @@ search_github = searcher("gh")
295303
#' @export
296304
search_gh = search_github
297305

306+
#' @rdname search_site
307+
#' @export
308+
#' @section grep.app Search:
309+
#' The `search_grep()` function searches all public code on
310+
#' [GitHub](https://github.com) using [grep.app](https://grep.app) by
311+
#' querying: `https://grep.app/search?q=<query-here>&filter[lang][0]=R`
312+
search_grep = searcher("grep")
313+
298314
#' @rdname search_site
299315
#' @export
300316
#' @section BitBucket Search:

README.Rmd

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ The `search_*()` functions can be used to search a query directly from _R_ on
6464
major search engines, programming help websites, and code repositories. The following search
6565
platforms are supported: [Google](https://www.google.com), [Bing](https://www.bing.com/),
6666
[DuckDuckGo](https://duckduckgo.com/), [Startpage](https://www.startpage.com/en/),
67-
Ecosia, [rseek](https://rseek.org/),
68-
[Twitter](https://twitter.com/search), [StackOverflow](https://stackoverflow.com/search),
67+
Ecosia, [rseek](https://rseek.org/), [Twitter](https://twitter.com/search), [StackOverflow](https://stackoverflow.com/search),
6968
[RStudio Community](https://community.rstudio.com/search),
70-
[GitHub](https://github.com/search), and [BitBucket](https://bitbucket.org/product/).
69+
[GitHub](https://github.com/search), [grep.app](https://grep.app/),
70+
and [BitBucket](https://bitbucket.org/product/).
7171
By default, an appropriate suffix for each platform that ensures relevant
7272
results to _R_ is appended to all queries. This behavior can be disabled by
7373
using `rlang = FALSE`.
@@ -93,6 +93,10 @@ search_stackoverflow("linear regression", rlang = FALSE) # or search_so(...)
9393
search_rstudio_community("tips")
9494
search_rstudio_community("tips", rlang = FALSE) # or search_rscom(...)
9595

96+
# Searching GitHub code for graphs in R and other languages
97+
search_grep("graph")
98+
search_grep("graph", rlang = FALSE)
99+
96100
# Searching GitHub Issues for maps in R and other languages
97101
search_github("maps")
98102
search_github("maps", rlang = FALSE) # or search_gh(...)
@@ -138,6 +142,7 @@ search_bing()
138142
search_ecosia()
139143
search_rseek()
140144
search_twitter()
145+
search_grep()
141146
search_duckduckgo() # or search_ddg()
142147
search_startpage() # or search_sp()
143148
search_stackoverflow() # or search_so()

man/search_site.Rd

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/searcher-package.Rd

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)