|
21 | 21 | #' @section Options for controlling progression handlers: |
22 | 22 | #' |
23 | 23 | #' \describe{ |
24 | | -#' \item{\option{progressr.clear} / \env{R_PROGRESSR_CLEAR}:}{ |
| 24 | +#' \item{\option{progressr.clear}:}{ |
25 | 25 | #' (logical) |
26 | 26 | #' If TRUE, any output, typically visual, produced by a reporter will be cleared/removed upon completion, if possible. (Default: TRUE) |
27 | 27 | #' } |
28 | 28 | #' |
29 | | -#' \item{\option{progressr.enable} / \env{R_PROGRESSR_ENABLE}:}{ |
| 29 | +#' \item{\option{progressr.enable}:}{ |
30 | 30 | #' (logical) |
31 | 31 | #' If FALSE, then progress is not reported. |
32 | 32 | #' (Default: TRUE) |
33 | 33 | #' } |
34 | 34 | #' |
35 | | -#' \item{\option{progressr.enable_after} / \env{R_PROGRESSR_ENABLE_AFTER}:}{ |
| 35 | +#' \item{\option{progressr.enable_after}:}{ |
36 | 36 | #' (numeric) |
37 | 37 | #' Delay (in seconds) before progression updates are reported. |
38 | 38 | #' (Default: `0.0`) |
39 | 39 | #' } |
40 | 40 | #' |
41 | | -#' \item{\option{progressr.times} / \env{R_PROGRESSR_TIMES}:}{ |
| 41 | +#' \item{\option{progressr.times}:}{ |
42 | 42 | #' (numeric) |
43 | 43 | #' The maximum number of times a handler should report progression updates. If zero, then progress is not reported. |
44 | 44 | #' (Default: `+Inf`) |
45 | 45 | #' } |
46 | 46 | #' |
47 | | -#' \item{\option{progressr.interval} / \env{R_PROGRESSR_INTERVAL}:}{ |
| 47 | +#' \item{\option{progressr.interval}:}{ |
48 | 48 | #' (numeric) |
49 | 49 | #' The minimum time (in seconds) between successive progression updates from this handler. |
50 | 50 | #' (Default: `0.0`) |
|
93 | 93 | #' \item{\option{progressr.demo.delay}:}{(numeric) Delay (in seconds) between each iteration of [slow_sum()]. (Default: `1.0`)} |
94 | 94 | #' } |
95 | 95 | #' |
| 96 | +#' @section Environment variables that set R options: |
| 97 | +#' Some of the above \R \option{progressr.*} options can be set by corresponding |
| 98 | +#' environment variable \env{R_PROGRESSR_*} _when the \pkg{progressr} package |
| 99 | +#' is loaded_. |
| 100 | +#' For example, if `R_PROGRESSR_ENABLE = "true"`, then option |
| 101 | +#' \option{progressr.enable} is set to `TRUE` (logical). |
| 102 | +#' For example, if `R_PROGRESSR_ENABLE_AFTER = "2.0"`, then option |
| 103 | +#' \option{progressr.enable_after} is set to `2.0` (numeric). |
96 | 104 | #' |
97 | 105 | #' @seealso |
98 | 106 | #' To set \R options when \R starts (even before the \pkg{progressr} package is loaded), see the \link[base]{Startup} help page. The \href{https://cran.r-project.org/package=startup}{\pkg{startup}} package provides a friendly mechanism for configuring \R at startup. |
@@ -218,6 +226,16 @@ update_package_option <- function(name, mode = "character", default = NULL, pack |
218 | 226 | update_package_options <- function(debug = FALSE) { |
219 | 227 | update_package_option("demo.delay", mode = "numeric", debug = debug) |
220 | 228 |
|
| 229 | + ## make_progression_handler() arguments |
| 230 | + update_package_option("clear", mode = "logical", default = TRUE, debug = debug) |
| 231 | + update_package_option("enable", mode = "logical", default = interactive(), debug = debug) |
| 232 | + update_package_option("enable_after", mode = "numeric", default = 0.0, debug = debug) |
| 233 | + update_package_option("interval", mode = "numeric", default = 0.0, debug = debug) |
| 234 | + update_package_option("times", mode = "numeric", default = +Inf, debug = debug) |
| 235 | + |
| 236 | + ## Life-cycle, e.g. deprecation an defunct |
| 237 | + update_package_option("lifecycle.progress", mode = "character", default = "deprecated", debug = debug) |
| 238 | + |
221 | 239 | ## However, not used |
222 | 240 | update_package_option("global.handler", mode = "logical", debug = debug) |
223 | 241 | } |
0 commit comments