handler_cli {progressr} | R Documentation |
Progression Handler: Progress Reported via 'cli' Progress Bars (Text) in the Terminal
Description
A progression handler for cli::cli_progress_bar()
.
Usage
handler_cli(
show_after = 0,
intrusiveness = getOption("progressr.intrusiveness.terminal", 1),
target = "terminal",
...
)
Arguments
show_after |
(numeric) Number of seconds to wait before displaying the progress bar. |
intrusiveness |
(numeric) A non-negative scalar on how intrusive (disruptive) the reporter to the user. |
target |
(character vector) Specifies where progression updates are rendered. |
... |
Additional arguments passed to |
Requirements
This progression handler requires the cli package.
Appearance
Below are a few examples on how to use and customize this progress handler.
In all cases, we use handlers(global = TRUE)
.
handlers("cli") y <- slow_sum(1:25)
handlers(handler_cli(format = "{cli::pb_spin} {cli::pb_bar} {cli::pb_current}/{cli::pb_total} {cli::pb_status}")) y <- slow_sum(1:25)
Examples
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)
}
[Package progressr version 0.14.0 Index]