cli_progress_message: Simplified cli progress messages

View source: R/progress-client.R

cli_progress_messageR Documentation

Simplified cli progress messages

Description

This is a simplified progress bar, a single (dynamic) message, without progress units.

Usage

cli_progress_message(
  msg,
  current = TRUE,
  .auto_close = TRUE,
  .envir = parent.frame(),
  ...
)

Arguments

msg

Message to show. It may contain glue substitution and cli styling. It can be updated via cli_progress_update(), as usual.

current

Passed to cli_progress_bar().

.auto_close

Passed to cli_progress_bar().

.envir

Passed to cli_progress_bar().

...

Passed to cli_progress_bar().

Details

cli_progress_message() always shows the message, even if no update is due. When the progress message is terminated, it is removed from the screen by default.

Note that the message can be dynamic: if you update it with cli_progress_update(), then cli uses the current values in the string substitutions.

fun <- function() {
  cli_progress_message("Task one is running...")
  Sys.sleep(2)

  cli_progress_message("Task two is running...")
  Sys.sleep(2)

  step <- 1L
  cli_progress_message("Task three is underway: step {step}")
  for (step in 1:5) {
    Sys.sleep(0.5)
    cli_progress_update()
  }
}
fun()

progress-message.svg

Value

The id of the new progress bar.

See Also

This function supports inline markup.

cli_progress_bar() for the complete progress bar API. cli_progress_step() for a similar display that is styled by default.

Other progress bar functions: cli_progress_along(), cli_progress_bar(), cli_progress_builtin_handlers(), cli_progress_num(), cli_progress_output(), cli_progress_step(), cli_progress_styles(), progress-variables

Other functions supporting inline markup: cli_abort(), cli_alert(), cli_blockquote(), cli_bullets_raw(), cli_bullets(), cli_dl(), cli_h1(), cli_li(), cli_ol(), cli_process_start(), cli_progress_along(), cli_progress_bar(), cli_progress_output(), cli_progress_step(), cli_rule, cli_status_update(), cli_status(), cli_text(), cli_ul(), format_error(), format_inline()


cli documentation built on June 22, 2024, 10:57 a.m.