From 17b550851a52382ca7bceec4b8a5481f00fab47b Mon Sep 17 00:00:00 2001 From: Jordan Mark Barbone Date: Sat, 14 Oct 2023 23:32:50 -0400 Subject: [PATCH] formatting --- R/news.R | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/R/news.R b/R/news.R index c7027dd..a51f2da 100644 --- a/R/news.R +++ b/R/news.R @@ -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") @@ -64,7 +67,7 @@ try0(urlchecker::url_check(path = temp, progress = FALSE)) } - writeLines(new, path) + writeLines(new, news) } get_desc_url <- function(x = ".") {