R/update_progress.R

Defines functions update_progress

Documented in update_progress

#' updating progress bars
#'
#' Takes care of updating a progress bar and stopping when appropriate
#'
#' @param .pb the progress bar object
#'
#' @export
#' @return the progress bar
update_progress <- function(.pb = NULL) {
  if ((!is.null(.pb)) && inherits(.pb, "Progress") && (.pb$i < .pb$n)) .pb$tick()$print()

  if ((!is.null(.pb)) && inherits(.pb, "Progress") && (.pb$i == .pb$n)) .pb$stop()$print()

  .pb
}
rmflight/knitrProgressBar documentation built on July 25, 2024, 5:57 a.m.