R/progress-ticking.R

Defines functions ticking

Documented in ticking

#' @export

ticking <- function(cond, name = NULL, ..., .envir = parent.frame()) {
  val <- force(cond)

  new <- is.null(clienv$progress_ids[[format(.envir)]])

  if (new && val) cli_progress_bar(name = name, ..., .envir = .envir)

  if (val) {
    cli_progress_update(.envir = .envir)
  } else {
    cli_progress_done(.envir = .envir)
  }

  val
}
r-pkgs/boxes documentation built on April 27, 2024, 11:08 a.m.