R/parse.repo.R

Defines functions parse.repo

Documented in parse.repo

#' @rdname TAF-internal
#'
#' @importFrom utils head tail
#'
#' @export

## Split repo string, without depending on 'remotes' package

parse.repo <- function(repo)
{
  ## 1  Read ref, then remove @reference tail
  ref <- if(grepl("@",repo)) unlist(strsplit(repo,"@"))[2] else ""
  repo <- sub("@.*", "", repo)

  ## 2  Read username, repo, subdir
  x <- unlist(strsplit(repo, "/"))
  username <- x[1]
  repo <- x[2]
  subdir <- if(length(x) > 2) paste(x[-c(1,2)],collapse="/") else ""

  list(username=username, repo=repo, subdir=subdir, ref=ref)
}

Try the TAF package in your browser

Any scripts or data that you put into this service are public.

TAF documentation built on April 7, 2021, 5:06 p.m.