|
21 | 21 |
|
22 | 22 | ask_to_switch_to_non_default_cache_root <- function(ask = interactive()) {
|
23 | 23 | if (ask && runif(1) > 0.9 && is.null(getOption("styler.cache_root"))) {
|
24 |
| - cli::cli_inform(paste0( |
25 |
| - "The R option `styler.cache_root` is not set, which means the cache ", |
26 |
| - "will get cleaned up after 6 days (and repeated styling will be slower).", |
27 |
| - " To keep cache files longer, set ", |
28 |
| - "the option to location within the {{R.cache}} cache where you want to ", |
29 |
| - "store the cache, e.g. `\"styler-perm\"`.\n\n", |
30 |
| - "options(styler.cache_root = \"styler-perm\")\n\n", |
31 |
| - "in your .Rprofile. Note that the cache literally ", |
32 |
| - "takes zero space on your disk, only the inode, and you can always ", |
33 |
| - "manually clean up with `styler::cache_clear()`, and if you update the ", |
34 |
| - "{{styler}} package, the cache is removed in any case. To ignore this ", |
35 |
| - "message in the future, set the default explictly to \"styler\" with\n\n", |
36 |
| - "options(styler.cache_root = \"styler\")\n\nin your `.Rprofile`. This ", |
37 |
| - "message will only be displayed once in a while.\n" |
38 |
| - )) |
| 24 | + ask_to_switch_to_non_default_cache_root_impl() |
39 | 25 | options(styler.cache_root = "styler")
|
40 | 26 | }
|
41 | 27 | }
|
42 | 28 |
|
| 29 | +ask_to_switch_to_non_default_cache_root_impl <- function() { |
| 30 | + rlang::warn(paste0( |
| 31 | + "The R option `styler.cache_root` is not set, which means the cache ", |
| 32 | + "will get cleaned up after 6 days (and repeated styling will be slower).", |
| 33 | + " To keep cache files longer, set ", |
| 34 | + "the option to location within the {R.cache} cache where you want to ", |
| 35 | + "store the cache, e.g. `\"styler-perm\"`.\n\n", |
| 36 | + "options(styler.cache_root = \"styler-perm\")\n\n", |
| 37 | + "in your .Rprofile. Note that the cache literally ", |
| 38 | + "takes zero space on your disk, only the inode, and you can always ", |
| 39 | + "manually clean up with `styler::cache_clear()`, and if you update the ", |
| 40 | + "{styler} package, the cache is removed in any case. To ignore this ", |
| 41 | + "message in the future, set the default explictly to \"styler\" with\n\n", |
| 42 | + "options(styler.cache_root = \"styler\")\n\nin your `.Rprofile`. This ", |
| 43 | + "message will only be displayed once in a while.\n" |
| 44 | + )) |
| 45 | +} |
| 46 | + |
43 | 47 | remove_old_cache_files <- function() {
|
44 | 48 | all_cached <- list.files(
|
45 | 49 | R.cache::getCachePath(c("styler", styler_version)),
|
|
0 commit comments