R/handler_cli.R
handler_cli.Rd
A progression handler for cli::cli_progress_bar()
.
handler_cli(
show_after = 0,
intrusiveness = getOption("progressr.intrusiveness.terminal", 1),
target = "terminal",
...
)
(numeric) Number of seconds to wait before displaying the progress bar.
(numeric) A non-negative scalar on how intrusive (disruptive) the reporter to the user.
(character vector) Specifies where progression updates are rendered.
Additional arguments passed to make_progression_handler()
.
This progression handler requires the cli package.
Below are a few examples on how to use and customize this progress handler.
In all cases, we use handlers(global = TRUE)
.
handlers(handler_cli(format = "{cli::pb_spin} {cli::pb_bar} {cli::pb_current}/{cli::pb_total} {cli::pb_status}"))
y <- slow_sum(1:25)
if (requireNamespace("cli", quietly = TRUE)) {
handlers(handler_cli(format = "{cli::pb_spin} {cli::pb_bar} {cli::pb_percent} {cli::pb_status}"))
with_progress({ y <- slow_sum(1:10) })
print(y)
}
#> M: Added value 1
#> M: Added value 2
#> M: Added value 3
#> M: Added value 4
#> M: Added value 5
#> M: Added value 6
#> M: Added value 7
#> M: Added value 8
#> M: Added value 9
#> M: Added value 10
#> [1] 55