R/install-sourcehut.R

Defines functions install_sourcehut

Documented in install_sourcehut

#' Install a package from a SourceHut git repository
#'
#' Works like [remotes::install_gitlab()], [remotes::install_bitbucket()], [remotes::install_github()] (etc).
#' You can also omit the leading tilde ("~") from the username portion of the repository address
#'
#' @param repo Repository address in the format `username/repo`. You can specify `subdir` and/or `ref` using the
#'        respective parameters (via `...`).
#' @param ... passed on to [remotes::install_git()]
#' @export
install_sourcehut <- function(repo, ...) {

  repo <- repo[1]

  if (!startsWith(repo, "~")) repo <- glue::glue("~{repo}")

  remotes::install_git(url = glue::glue("https://git.sr.ht/{repo}"), ...)

}
hrbrmstr/sourcehut documentation built on Nov. 4, 2019, 1:46 p.m.