Write some text to the screen. This function is most appropriate for
longer paragraphs. See cli_alert()
for shorter status messages.
Usage
cli_text(..., .envir = parent.frame())
Arguments
- ...
The text to show, in character vectors. They will be concatenated into a single string. Newlines are not preserved.
- .envir
Environment to evaluate the glue expressions in.
Details
Text wrapping
Text is wrapped to the console width, see console_width()
.
cli_text(cli:::lorem_ipsum())
#> Lorem ad ipsum veniam esse nisi deserunt duis. Qui incididunt elit #> elit mollit sint nulla consectetur aute commodo do elit laboris minim #> et. Laboris ipsum mollit voluptate et non do incididunt eiusmod. Anim #> consectetur mollit laborum occaecat eiusmod excepteur. Ullamco non #> tempor esse anim tempor magna non.
New lines
A cli_text()
call always appends a newline character to the end.
#> First line. #> Second line.
Styling
You can use inline markup, as usual.
cli_text("The {.fn cli_text} function in the {.pkg cli} package.")
#> The `cli_text()` function in the cli package.
Interpolation
String interpolation via glue works as usual. Interpolated vectors are collapsed.
#> We have 4 missing measurements: 5, 14, 25, and 26.
Styling and interpolation
Use double braces to combine styling and string interpolation.
fun <- "cli-text"
pkg <- "cli"
cli_text("The {.fn {fun}} function in the {.pkg {pkg}} package.")
#> The `cli-text()` function in the cli package.
See also
This function supports inline markup.
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_message()
,
cli_progress_output()
,
cli_progress_step()
,
cli_rule
,
cli_status_update()
,
cli_status()
,
cli_ul()
,
format_error()
,
format_inline()