Skip to content

Commit

Permalink
Adjust logic for write_union to not require usethis
Browse files Browse the repository at this point in the history
Fixes #193
  • Loading branch information
schloerke committed May 3, 2022
1 parent d8e4a49 commit 7a18f80
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,14 @@ write_union <- function(path, lines, comments = NULL, quiet = FALSE) {
return(invisible(FALSE))
}
if (!quiet) {
rlang::check_installed("usethis")
usethis::ui_done("Adding {usethis::ui_value(new)} to {usethis::ui_path(path)}")
# Try to not depend on usethis if possible
if (rlang::is_installed("usethis")) {
usethis::ui_done("Adding {usethis::ui_value(new)} to {usethis::ui_path(path)}")
} else {
rlang::inform(c("*" = paste0(
"Adding ", new, " to ", path
)))
}
}
all_txt <- paste0(c(existing_lines, comments, new), collapse = "\n")
if (!grepl("\n$", all_txt)) {
Expand Down

0 comments on commit 7a18f80

Please sign in to comment.