cli_fmt: Capture the output of cli functions instead of printing it

View source: R/cli.R

cli_fmtR Documentation

Capture the output of cli functions instead of printing it

Description

Capture the output of cli functions instead of printing it

Usage

cli_fmt(expr, collapse = FALSE, strip_newline = FALSE)

Arguments

expr

Expression to evaluate, containing ⁠cli_*()⁠ calls, typically.

collapse

Whether to collapse the output into a single character scalar, or return a character vector with one element for each line.

strip_newline

Whether to strip the trailing newline.

Examples

cli_fmt({
  cli_alert_info("Loading data file")
  cli_alert_success("Loaded data file")
})

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