Skip to content

Commit 80e2729

Browse files
committed
Specify number when browsing GitHub issues/pulls
1 parent 911dcfd commit 80e2729

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
* `use_tidy_versions()` sets minimum version requirement for all dependencies.
1111

12-
* New family of `browse_` functions that open useful websites (#96).
12+
* New family of `browse_` functions that open useful websites (#96, #103).
1313

1414
* `use_r()` creates and opens an `.R` file
1515

R/browse.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#' Quickly browse to important package webpages
22
#'
33
#' @param package Name of package; leave as `NULL` to use current package
4+
#' @param number For GitHub issues and pull requests. Can be a number or
5+
#' `"new"`.
46
#' @export
57
#' @examples
68
#' browse_cran("MASS")
@@ -10,14 +12,14 @@ browse_github <- function(package = NULL) {
1012

1113
#' @export
1214
#' @rdname browse_github
13-
browse_github_issues <- function(package = NULL) {
14-
view_url(github_home(package), "/issues")
15+
browse_github_issues <- function(package = NULL, number = NULL) {
16+
view_url(github_home(package), "issues", number)
1517
}
1618

1719
#' @export
1820
#' @rdname browse_github
19-
browse_github_pulls <- function(package = NULL) {
20-
view_url(github_home(package), "/pulls")
21+
browse_github_pulls <- function(package = NULL, number = NULL) {
22+
view_url(github_home(package), "pulls", number)
2123
}
2224

2325
#' @export

R/helpers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ edit_file <- function(base_path, path) {
185185
}
186186

187187
view_url <- function(..., open = interactive()) {
188-
url <- paste0(...)
188+
url <- paste(..., sep = "/")
189189
if (open) {
190190
done("Opening url")
191191
utils::browseURL(url)

0 commit comments

Comments
 (0)