From 3311a39db9928092e38416d9dfe524ededb2a7ca Mon Sep 17 00:00:00 2001 From: JoFrhwld Date: Tue, 26 Sep 2023 15:15:30 -0400 Subject: [PATCH] better warning with {cli} --- DESCRIPTION | 1 + R/density_area.R | 7 +++---- usethis_hist.R | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8a3ac28..13e11fc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,6 +16,7 @@ RoxygenNote: 7.2.3 URL: https://github.com/JoFrhwld/densityarea, https://jofrhwld.github.io/densityarea/ BugReports: https://github.com/JoFrhwld/densityarea/issues Imports: + cli, dplyr, ggdensity, isoband, diff --git a/R/density_area.R b/R/density_area.R index 2a7841b..a35290f 100644 --- a/R/density_area.R +++ b/R/density_area.R @@ -49,10 +49,9 @@ get_isolines_safely <- function(...){ if(!is.null(iso_result$error)){ dots <- rlang::dots_list(...) data_len <- length(dots$x) - warning( - glue::glue( - "There was a problem calculating probability isolines.\nℹ There were {data_len} values in the input." - ) + cli::cli_warn( + c("There was a problem calculating probability isolines.", + "i" = "There {?was/were} {data_len} x,y pair{?s} in the input.") ) } diff --git a/usethis_hist.R b/usethis_hist.R index e242ddc..e50b68c 100644 --- a/usethis_hist.R +++ b/usethis_hist.R @@ -57,6 +57,7 @@ usethis::use_package("sf") usethis::use_package("tidyr") usethis::use_package("sfheaders") usethis::use_package("vctrs") +usethis::use_package("cli") ## suggests ---- usethis::use_package("readr", type = "Suggests")