diff --git a/DESCRIPTION b/DESCRIPTION index 318bdb1..5117179 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,7 +23,7 @@ BugReports: https://github.com/coatless-rpkg/searcher/issues Depends: R (>= 3.3.0) License: GPL (>= 2) Encoding: UTF-8 -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Roxygen: list(markdown = TRUE) Suggests: testthat (>= 2.1.0), diff --git a/NAMESPACE b/NAMESPACE index bbc133b..5f26607 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,6 +9,7 @@ export(search_ecosia) export(search_gh) export(search_github) export(search_google) +export(search_grep) export(search_ixquick) export(search_rscom) export(search_rseek) diff --git a/NEWS.md b/NEWS.md index ae6a99e..24531e6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +# searcher 0.0.7 + +## Features + +- Added search portal: + - `search_grep()`: Searches on grep.app. + ([#35](https://github.com/r-assist/searcher/issues/35), + [#37](https://github.com/r-assist/searcher/pull/37)) + + # searcher 0.0.6 ## Features diff --git a/R/index-sites.R b/R/index-sites.R index a25baac..fcbaf3c 100644 --- a/R/index-sites.R +++ b/R/index-sites.R @@ -45,6 +45,8 @@ site_index = list( site_entry("google", "https://google.com/search?q="), site_entry("bing", "https://bing.com/search?q="), + site_entry("grep", "https://grep.app/search?q=", + keywords = keyword_entry("&filter[lang][0]=R")), site_entry("duckduckgo", "https://duckduckgo.com/?q=", "ddg"), site_entry("startpage", "https://startpage.com/do/dsearch?query=", "sp"), site_entry("ecosia", "https://www.ecosia.org/search?q="), diff --git a/R/search-functions.R b/R/search-functions.R index 8394bf8..31f8f94 100644 --- a/R/search-functions.R +++ b/R/search-functions.R @@ -17,7 +17,7 @@ #' @seealso [search_google()], [search_bing()], [search_duckduckgo()], #' [search_startpage()], [search_rseek()], [search_twitter()], #' [search_rstudio_community()], [search_stackoverflow()], -#' [search_github()], [search_bitbucket()], and [searcher()] +#' [search_github()], [search_grep()], [search_bitbucket()], and [searcher()] #' @examples #' # Search in a generic way #' search_site("r-project", "google") @@ -55,6 +55,12 @@ #' # Search all languages on GitHub Issues for bivariate normal #' search_github("bivariate normal", rlang = FALSE) #' +#' # Search R code on GitHub for numerical optimization +#' search_grep("optim") +#' +#' # Search all code on GitHub for numerical optimization +#' search_grep("optim", rlang = FALSE) +#' #' # Search BitBucket for assertions #' search_bitbucket("assertions") #' @@ -79,6 +85,7 @@ search_site = function(query, "so", "github", "gh", + "grep", "bitbucket", "bb" ), @@ -102,6 +109,7 @@ search_site = function(query, so = search_stackoverflow(query, rlang), github = , # empty case carried below gh = search_github(query, rlang), + grep = search_grep(query, rlang), bitbucket = , # empty case carried below bb = search_bitbucket(query, rlang) ) @@ -295,6 +303,14 @@ search_github = searcher("gh") #' @export search_gh = search_github +#' @rdname search_site +#' @export +#' @section grep.app Search: +#' The `search_grep()` function searches all public code on +#' [GitHub](https://github.com) using [grep.app](https://grep.app) by +#' querying: `https://grep.app/search?q=&filter[lang][0]=R` +search_grep = searcher("grep") + #' @rdname search_site #' @export #' @section BitBucket Search: diff --git a/README.Rmd b/README.Rmd index 8649c5e..883e1bc 100644 --- a/README.Rmd +++ b/README.Rmd @@ -64,10 +64,10 @@ The `search_*()` functions can be used to search a query directly from _R_ on major search engines, programming help websites, and code repositories. The following search platforms are supported: [Google](https://www.google.com), [Bing](https://www.bing.com/), [DuckDuckGo](https://duckduckgo.com/), [Startpage](https://www.startpage.com/en/), -Ecosia, [rseek](https://rseek.org/), -[Twitter](https://twitter.com/search), [StackOverflow](https://stackoverflow.com/search), +Ecosia, [rseek](https://rseek.org/), [Twitter](https://twitter.com/search), [StackOverflow](https://stackoverflow.com/search), [RStudio Community](https://community.rstudio.com/search), -[GitHub](https://github.com/search), and [BitBucket](https://bitbucket.org/product/). +[GitHub](https://github.com/search), [grep.app](https://grep.app/), +and [BitBucket](https://bitbucket.org/product/). By default, an appropriate suffix for each platform that ensures relevant results to _R_ is appended to all queries. This behavior can be disabled by using `rlang = FALSE`. @@ -93,6 +93,10 @@ search_stackoverflow("linear regression", rlang = FALSE) # or search_so(...) search_rstudio_community("tips") search_rstudio_community("tips", rlang = FALSE) # or search_rscom(...) +# Searching GitHub code for graphs in R and other languages +search_grep("graph") +search_grep("graph", rlang = FALSE) + # Searching GitHub Issues for maps in R and other languages search_github("maps") search_github("maps", rlang = FALSE) # or search_gh(...) @@ -138,6 +142,7 @@ search_bing() search_ecosia() search_rseek() search_twitter() +search_grep() search_duckduckgo() # or search_ddg() search_startpage() # or search_sp() search_stackoverflow() # or search_so() diff --git a/man/search_site.Rd b/man/search_site.Rd index c30e63a..5811ea0 100644 --- a/man/search_site.Rd +++ b/man/search_site.Rd @@ -18,6 +18,7 @@ \alias{search_so} \alias{search_github} \alias{search_gh} +\alias{search_grep} \alias{search_bitbucket} \alias{search_bb} \title{Search a Query on a Search Portal in a Web Browser} @@ -26,7 +27,7 @@ search_site( query, site = c("google", "bing", "duckduckgo", "ddg", "startpage", "sp", "rseek", "rstudio community", "rscom", "twitter", "stackoverflow", "so", "github", "gh", - "bitbucket", "bb"), + "grep", "bitbucket", "bb"), rlang = TRUE ) @@ -62,6 +63,8 @@ search_github(query = geterrmessage(), rlang = TRUE) search_gh(query = geterrmessage(), rlang = TRUE) +search_grep(query = geterrmessage(), rlang = TRUE) + search_bitbucket(query = geterrmessage(), rlang = TRUE) search_bb(query = geterrmessage(), rlang = TRUE) @@ -177,6 +180,13 @@ search interface please see: and \url{https://help.github.com/articles/searching-code/} } +\section{grep.app Search}{ + +The \code{search_grep()} function searches all public code on +\href{https://github.com}{GitHub} using \href{https://grep.app}{grep.app} by +querying: \verb{https://grep.app/search?q=&filter[lang][0]=R} +} + \section{BitBucket Search}{ The \code{search_bitbucket()} and \code{search_bb()} functions both search @@ -225,6 +235,12 @@ search_github("bivariate normal") # Search all languages on GitHub Issues for bivariate normal search_github("bivariate normal", rlang = FALSE) +# Search R code on GitHub for numerical optimization +search_grep("optim") + +# Search all code on GitHub for numerical optimization +search_grep("optim", rlang = FALSE) + # Search BitBucket for assertions search_bitbucket("assertions") @@ -238,5 +254,5 @@ options(error = search_google) \code{\link[=search_google]{search_google()}}, \code{\link[=search_bing]{search_bing()}}, \code{\link[=search_duckduckgo]{search_duckduckgo()}}, \code{\link[=search_startpage]{search_startpage()}}, \code{\link[=search_rseek]{search_rseek()}}, \code{\link[=search_twitter]{search_twitter()}}, \code{\link[=search_rstudio_community]{search_rstudio_community()}}, \code{\link[=search_stackoverflow]{search_stackoverflow()}}, -\code{\link[=search_github]{search_github()}}, \code{\link[=search_bitbucket]{search_bitbucket()}}, and \code{\link[=searcher]{searcher()}} +\code{\link[=search_github]{search_github()}}, \code{\link[=search_grep]{search_grep()}}, \code{\link[=search_bitbucket]{search_bitbucket()}}, and \code{\link[=searcher]{searcher()}} } diff --git a/man/searcher-package.Rd b/man/searcher-package.Rd index c9c752f..b0ad90d 100644 --- a/man/searcher-package.Rd +++ b/man/searcher-package.Rd @@ -3,7 +3,6 @@ \docType{package} \name{searcher-package} \alias{searcher-package} -\alias{_PACKAGE} \title{searcher: Query Search Interfaces} \description{ Provides a search interface to look up terms on 'Google', 'Bing', 'DuckDuckGo', 'Startpage', 'Ecosia', 'rseek', 'Twitter', 'StackOverflow', 'RStudio Community', 'GitHub', and 'BitBucket'. Upon searching, a browser window will open with the aforementioned search results.