Skip to content

Commit

Permalink
chore: Better default fallback message
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Mar 8, 2024
1 parent bd33d6f commit 8198166
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
13 changes: 9 additions & 4 deletions R/fallback.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ fallback_sitrep <- function() {
fallback_txt_header(),

if (is.na(fallback_logging)) {
c("i" = "Fallback logging is not controlled. Enable or disable it by setting the {.envvar DUCKPLYR_FALLBACK_COLLECT} environment variable.")
c("i" = "Fallback logging is not controlled and therefore disabled. Enable or disable it by setting the {.envvar DUCKPLYR_FALLBACK_COLLECT} environment variable.")
} else if (fallback_logging) {
c(
"v" = "Fallback logging is enabled.",
"i" = "Logs are written to {.file {fallback_log_dir}}.",
if (is.na(fallback_verbose)) {
c("i" = "Fallback printing is not controlled. Enable or disable it by setting the {.envvar DUCKPLYR_FALLBACK_VERBOSE} environment variable.")
c("i" = "Fallback printing is not controlled and therefore disabled. Enable or disable it by setting the {.envvar DUCKPLYR_FALLBACK_VERBOSE} environment variable.")
} else if (fallback_verbose) {
c("v" = "Fallback printing is enabled.")
} else {
Expand All @@ -91,7 +91,12 @@ fallback_sitrep <- function() {
},

fallback_txt_uploading(fallback_uploading),
fallback_txt_sitrep_logs(fallback_logs)

if (isTRUE(fallback_logging)) {
fallback_txt_sitrep_logs(fallback_logs)
},

NULL
)

cli_inform(msg)
Expand All @@ -103,7 +108,7 @@ fallback_txt_header <- function() {

fallback_txt_uploading <- function(fallback_uploading) {
if (is.na(fallback_uploading)) {
c("i" = "Fallback uploading is not controlled. Enable or disable it by setting the {.envvar DUCKPLYR_FALLBACK_AUTOUPLOAD} environment variable.")
c("i" = "Fallback uploading is not controlled and therefore disabled. Enable or disable it by setting the {.envvar DUCKPLYR_FALLBACK_AUTOUPLOAD} environment variable.")
} else if (fallback_uploading) {
c("v" = "Fallback uploading is enabled.")
} else {
Expand Down
7 changes: 2 additions & 5 deletions tests/testthat/_snaps/fallback.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
fallback_sitrep()
Message
The duckplyr package is configured to fall back to dplyr when it encounters an incompatibility. Fallback events can be collected and uploaded for analysis to guide future development. See `?duckplyr::fallback()` for details.
i Fallback logging is not controlled. Enable or disable it by setting the `DUCKPLYR_FALLBACK_COLLECT` environment variable.
i Fallback uploading is not controlled. Enable or disable it by setting the `DUCKPLYR_FALLBACK_AUTOUPLOAD` environment variable.
i No reports ready for upload.
i Fallback logging is not controlled and therefore disabled. Enable or disable it by setting the `DUCKPLYR_FALLBACK_COLLECT` environment variable.
i Fallback uploading is not controlled and therefore disabled. Enable or disable it by setting the `DUCKPLYR_FALLBACK_AUTOUPLOAD` environment variable.

# fallback_sitrep() enabled

Expand Down Expand Up @@ -42,8 +41,6 @@
The duckplyr package is configured to fall back to dplyr when it encounters an incompatibility. Fallback events can be collected and uploaded for analysis to guide future development. See `?duckplyr::fallback()` for details.
x Fallback logging is disabled.
x Fallback uploading is disabled.
v Number of reports ready for upload: 3.
> Review with `duckplyr::fallback_review()`, upload with `duckplyr::fallback_upload()`.

# fallback_nudge()

Expand Down

0 comments on commit 8198166

Please sign in to comment.