Skip to content

Commit

Permalink
Merge pull request #20 from krlmlr/b-10-ssh
Browse files Browse the repository at this point in the history
fix: Support parsing SSH URLs
  • Loading branch information
gaborcsardi committed Mar 25, 2024
1 parent b582016 commit 1eda4ec
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,20 @@ parse_url <- function(url) {
)

mch <- re_match(url, re_url)
mch[, setdiff(colnames(mch), c(".match", ".text")), drop = FALSE]

if (is.na(mch[[1]])) {
ssh_re_url <- "^git@(?<host>[^:]+):(?<path>.*)[.]git$"
mch <- re_match(url, ssh_re_url)

if (is.na(mch[[1]])) {
cli::cli_abort("Invalid URL: {.url {url}}")
}

# Used for accessing the server's API
mch$protocol <- "https"
}

mch[c("protocol", "host", "path")]
}

read_file <- function(path) {
Expand Down

0 comments on commit 1eda4ec

Please sign in to comment.