Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 2f5c14d

Browse files
authored
Merge pull request #66 from sboysel/set-gh-username
gists(what = "mineall") throws error if 'github.username' is not set
2 parents bc1e15c + bbb23de commit 2f5c14d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

R/gist_auth.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#' }
2323

2424
gist_auth <- function(app = gistr_app, reauth = FALSE) {
25-
25+
2626
if (exists("auth_config", envir = cache) && !reauth) {
2727
return(cache$auth_config)
2828
}

R/gists.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ gists <- function(what='public', since=NULL, page=NULL, per_page=30, ...) {
3737
}
3838

3939
switch_url <- function(x, id){
40-
switch(x,
40+
if (identical(x, "mineall") & is.null(getOption("github.username"))) {
41+
stop("'github.username' is not set. Please set using `options(github.username = 'your_github_username')`")
42+
}
43+
switch(x,
4144
public = paste0(ghbase(), '/gists/public'),
4245
minepublic = paste0(ghbase(), '/gists'),
4346
mineall = sprintf('%s/users/%s/gists', ghbase(), getOption("github.username")),

0 commit comments

Comments
 (0)