Examples for 'cli::cli_process_start'


Indicate the start and termination of some computation in the status bar (superseded)

Aliases: cli_process_start cli_process_done cli_process_failed

Keywords:

### ** Examples


## Failure by default
fun <- function() {
  cli_process_start("Calculating")
  if (interactive()) Sys.sleep(1)
  if (runif(1) < 0.5) stop("Failed")
  cli_process_done()
}
tryCatch(fun(), error = function(err) err)
ℹ Calculating
✔ Calculating ... done
## Success by default
fun2 <- function() {
  cli_process_start("Calculating", on_exit = "done")
  tryCatch({
    if (interactive()) Sys.sleep(1)
    if (runif(1) < 0.5) stop("Failed")
  }, error = function(err) cli_process_failed())
}
fun2()
ℹ Calculating
✔ Calculating ... done

[Package cli version 3.6.3 Index]