| cli_alert | R Documentation |
Alerts are typically short status messages.
cli_alert(text, id = NULL, class = NULL, wrap = FALSE, .envir = parent.frame())
cli_alert_success(
text,
id = NULL,
class = NULL,
wrap = FALSE,
.envir = parent.frame()
)
cli_alert_danger(
text,
id = NULL,
class = NULL,
wrap = FALSE,
.envir = parent.frame()
)
cli_alert_warning(
text,
id = NULL,
class = NULL,
wrap = FALSE,
.envir = parent.frame()
)
cli_alert_info(
text,
id = NULL,
class = NULL,
wrap = FALSE,
.envir = parent.frame()
)
text |
Text of the alert. |
id |
Id of the alert element. Can be used in themes. |
class |
Class of the alert element. Can be used in themes. |
wrap |
Whether to auto-wrap the text of the alert. |
.envir |
Environment to evaluate the glue expressions in. |
nbld <- 11
tbld <- prettyunits::pretty_sec(5.6)
cli_alert_success("Built {.emph {nbld}} status report{?s} in {tbld}.")
#> ✔ Built 11 status reports in 5.6s.
cfl <- "~/.cache/files/latest.cache"
cli_alert_info("Updating cache file {.path {cfl}}.")
#> ℹ Updating cache file ~/.cache/files/latest.cache.
cfl <- "~/.cache/files/latest.cache"
cli_alert_warning("Failed to update cache file {.path {cfl}}.")
#> ! Failed to update cache file ~/.cache/files/latest.cache.
cfl <- "~/.config/report.yaml"
cli_alert_danger("Cannot validate config file at {.path {cfl}}.")
#> ✖ Cannot validate config file at ~/.config/report.yaml.
Alerts are printed without wrapping, unless you set wrap = TRUE:
cli_alert_info("Data columns: {.val {names(mtcars)}}.")
cli_alert_info("Data columns: {.val {names(mtcars)}}.", wrap = TRUE)
#> ℹ Data columns: "mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", "vs", "am", "g #> ear", and "carb". #> ℹ Data columns: "mpg", "cyl", "disp", "hp", "drat", "wt", "qsec", #> "vs", "am", "gear", and "carb".
These functions supports inline markup.
Other functions supporting inline markup:
cli_abort(),
cli_blockquote(),
cli_bullets(),
cli_bullets_raw(),
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(),
cli_status_update(),
cli_text(),
cli_ul(),
format_error(),
format_inline()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.