% Generated by roxygen2: do not edit by hand % Please edit documentation in R/cli.R \name{cli_alert} \alias{cli_alert} \alias{cli_alert_success} \alias{cli_alert_danger} \alias{cli_alert_warning} \alias{cli_alert_info} \title{CLI alerts} \usage{ 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() ) } \arguments{ \item{text}{Text of the alert.} \item{id}{Id of the alert element. Can be used in themes.} \item{class}{Class of the alert element. Can be used in themes.} \item{wrap}{Whether to auto-wrap the text of the alert.} \item{.envir}{Environment to evaluate the glue expressions in.} } \description{ Alerts are typically short status messages. } \details{ \subsection{Success}{ \if{html}{\out{
    }}\preformatted{nbld <- 11
    tbld <- prettyunits::pretty_sec(5.6)
    cli_alert_success("Built \{.emph \{nbld\}\} status report\{?s\} in \{tbld\}.")
    }\if{html}{\out{
}}\if{html}{\out{

    #> ✔ Built 11 status reports in 5.6s.

}} } \subsection{Info}{ \if{html}{\out{
    }}\preformatted{cfl <- "~/.cache/files/latest.cache"
    cli_alert_info("Updating cache file \{.path \{cfl\}\}.")
    }\if{html}{\out{
}}\if{html}{\out{

    #> ℹ Updating cache file ~/.cache/files/latest.cache.

}} } \subsection{Warning}{ \if{html}{\out{
    }}\preformatted{cfl <- "~/.cache/files/latest.cache"
    cli_alert_warning("Failed to update cache file \{.path \{cfl\}\}.")
    }\if{html}{\out{
}}\if{html}{\out{

    #> ! Failed to update cache file ~/.cache/files/latest.cache.

}} } \subsection{Danger}{ \if{html}{\out{
    }}\preformatted{cfl <- "~/.config/report.yaml"
    cli_alert_danger("Cannot validate config file at \{.path \{cfl\}\}.")
    }\if{html}{\out{
}}\if{html}{\out{

    #> ✖ Cannot validate config file at ~/.config/report.yaml.

}} } \subsection{Text wrapping}{ Alerts are printed without wrapping, unless you set \code{wrap = TRUE}: \if{html}{\out{
    }}\preformatted{cli_alert_info("Data columns: \{.val \{names(mtcars)\}\}.")
    cli_alert_info("Data columns: \{.val \{names(mtcars)\}\}.", wrap = TRUE)
    }\if{html}{\out{
}}\if{html}{\out{

    #> ℹ 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".

}} } } \seealso{ These functions supports \link[=inline-markup]{inline markup}. Other functions supporting inline markup: \code{\link{cli_abort}()}, \code{\link{cli_blockquote}()}, \code{\link{cli_bullets_raw}()}, \code{\link{cli_bullets}()}, \code{\link{cli_dl}()}, \code{\link{cli_h1}()}, \code{\link{cli_li}()}, \code{\link{cli_ol}()}, \code{\link{cli_process_start}()}, \code{\link{cli_progress_along}()}, \code{\link{cli_progress_bar}()}, \code{\link{cli_progress_message}()}, \code{\link{cli_progress_output}()}, \code{\link{cli_progress_step}()}, \code{\link{cli_rule}}, \code{\link{cli_status_update}()}, \code{\link{cli_status}()}, \code{\link{cli_text}()}, \code{\link{cli_ul}()}, \code{\link{format_error}()}, \code{\link{format_inline}()} } \concept{functions supporting inline markup}