Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarbone committed Oct 15, 2023
1 parent 9e50a3b commit 17b5508
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions R/news.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,20 @@
ask = interactive(),
url = get_desc_url(path)
) {
stopifnot(length(path) == 1, is.character(path))
stopifnot(
length(path) == 1,
is.character(path),
dir.exists(path)
)

if (dir.exists(path)) {
path <- "NEWS.md"
}
news <- file.path(news, "NEWS.md")

if (!file.exists(path)) {
stop("Path not found: ", path)
if (!file.exists(news)) {
stop("NEWS.md not found: ", news)
}

old_copy <- new_copy <- old <- new <- readLines(path)
force(url)
old_copy <- new_copy <- old <- new <- readLines(news)
m <- regexpr("\\[\\#[0-9]+\\](?!\\(https)", old, perl = TRUE)
if (all(m == -1L)) {
message("no URLs detected")
Expand Down Expand Up @@ -64,7 +67,7 @@
try0(urlchecker::url_check(path = temp, progress = FALSE))
}

writeLines(new, path)
writeLines(new, news)
}

get_desc_url <- function(x = ".") {
Expand Down

0 comments on commit 17b5508

Please sign in to comment.