1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
% 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{<div class="sourceCode r">}}\preformatted{nbld <- 11
tbld <- prettyunits::pretty_sec(5.6)
cli_alert_success("Built \{.emph \{nbld\}\} status report\{?s\} in \{tbld\}.")
}\if{html}{\out{</div>}}\if{html}{\out{
<div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre>
#> <span style="color: #859900;">✔</span> Built <span style="font-style: italic;">11</span> status reports in 5.6s.
</pre></div>
}}
}
\subsection{Info}{
\if{html}{\out{<div class="sourceCode r">}}\preformatted{cfl <- "~/.cache/files/latest.cache"
cli_alert_info("Updating cache file \{.path \{cfl\}\}.")
}\if{html}{\out{</div>}}\if{html}{\out{
<div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre>
#> <span style="color: #2AA198;">ℹ</span> Updating cache file <span style="color: #268BD2;">~/.cache/files/latest.cache</span>.
</pre></div>
}}
}
\subsection{Warning}{
\if{html}{\out{<div class="sourceCode r">}}\preformatted{cfl <- "~/.cache/files/latest.cache"
cli_alert_warning("Failed to update cache file \{.path \{cfl\}\}.")
}\if{html}{\out{</div>}}\if{html}{\out{
<div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre>
#> <span style="color: #B58900;">!</span> Failed to update cache file <span style="color: #268BD2;">~/.cache/files/latest.cache</span>.
</pre></div>
}}
}
\subsection{Danger}{
\if{html}{\out{<div class="sourceCode r">}}\preformatted{cfl <- "~/.config/report.yaml"
cli_alert_danger("Cannot validate config file at \{.path \{cfl\}\}.")
}\if{html}{\out{</div>}}\if{html}{\out{
<div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre>
#> <span style="color: #DC322F;">✖</span> Cannot validate config file at <span style="color: #268BD2;">~/.config/report.yaml</span>.
</pre></div>
}}
}
\subsection{Text wrapping}{
Alerts are printed without wrapping, unless you set \code{wrap = TRUE}:
\if{html}{\out{<div class="sourceCode r">}}\preformatted{cli_alert_info("Data columns: \{.val \{names(mtcars)\}\}.")
cli_alert_info("Data columns: \{.val \{names(mtcars)\}\}.", wrap = TRUE)
}\if{html}{\out{</div>}}\if{html}{\out{
<div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre>
#> <span style="color: #2AA198;">ℹ</span> Data columns: <span style="color: #268BD2;">"mpg"</span>, <span style="color: #268BD2;">"cyl"</span>, <span style="color: #268BD2;">"disp"</span>, <span style="color: #268BD2;">"hp"</span>, <span style="color: #268BD2;">"drat"</span>, <span style="color: #268BD2;">"wt"</span>, <span style="color: #268BD2;">"qsec"</span>, <span style="color: #268BD2;">"vs"</span>, <span style="color: #268BD2;">"am"</span>, <span style="color: #268BD2;">"g</span>
#> <span style="color: #268BD2;">ear"</span>, and <span style="color: #268BD2;">"carb"</span>.
#> <span style="color: #2AA198;">ℹ</span> Data columns: <span style="color: #268BD2;">"mpg"</span>, <span style="color: #268BD2;">"cyl"</span>, <span style="color: #268BD2;">"disp"</span>, <span style="color: #268BD2;">"hp"</span>, <span style="color: #268BD2;">"drat"</span>, <span style="color: #268BD2;">"wt"</span>, <span style="color: #268BD2;">"qsec"</span>,
#> <span style="color: #268BD2;">"vs"</span>, <span style="color: #268BD2;">"am"</span>, <span style="color: #268BD2;">"gear"</span>, and <span style="color: #268BD2;">"carb"</span>.
</pre></div>
}}
}
}
\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}()},
\code{\link{cli_bullets_raw}()},
\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}()},
\code{\link{cli_status_update}()},
\code{\link{cli_text}()},
\code{\link{cli_ul}()},
\code{\link{format_error}()},
\code{\link{format_inline}()}
}
\concept{functions supporting inline markup}
|