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
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cli.R
\name{cli_end}
\alias{cli_end}
\title{Close a CLI container}
\usage{
cli_end(id = NULL)
}
\arguments{
\item{id}{Id of the container to close. If missing, the current
container is closed, if any.}
}
\description{
Containers aut0-close by default, but sometimes you need to explicitly
close them. Closing a container also closes all of its nested
containers.
}
\details{
\subsection{Explicit closing}{
\if{html}{\out{<div class="sourceCode r">}}\preformatted{cnt <- cli_par()
cli_text("First paragraph.")
cli_end(cnt)
cnt <- cli_par()
cli_text("Second paragraph.")
cli_end(cnt)
}\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>
#> First paragraph.
#>
#> Second paragraph.
#>
</pre></div>
}}
}
\subsection{Closing a stack of containers}{
\if{html}{\out{<div class="sourceCode r">}}\preformatted{list <- cli_ul()
cli_li("Item one:")
cli_li("Item two:")
cli_par()
cli_text("Still item two.")
cli_end(list)
cli_text("Not in the list any more")
}\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>
#> • Item one:
#> • Item two:
#> Still item two.
#>
#> Not in the list any more
</pre></div>
}}
}
\subsection{Omitting \code{id}}{
If \code{id} is omitted, the container that was opened last will be closed.
\if{html}{\out{<div class="sourceCode r">}}\preformatted{cli_par()
cli_text("First paragraph")
cli_end()
cli_par()
cli_text("Second paragraph")
cli_end()
}\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>
#> First paragraph
#>
#> Second paragraph
#>
</pre></div>
}}
}
\subsection{Debugging containers}{
You can use the internal \code{cli:::cli_debug_doc()} function to see the
currently open containers.
\if{html}{\out{<div class="sourceCode r">}}\preformatted{fun <- function() \{
cli_div(id = "mydiv")
cli_par(class = "myclass")
cli:::cli_debug_doc()
\}
fun()
}\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>
#> <cli document>
#> <body id="body">
#> <div id="mydiv"> +theme
#> <par id="cli-82040-64" class="myclass">
</pre></div>
}}
}
}
|