It can be used to separate parts of the output. The line style of the rule can be changed via the the line-type property. Possible values are:

cli_rule(
  left = "",
  center = "",
  right = "",
  id = NULL,
  .envir = parent.frame()
)

Arguments

left

Label to show on the left. It interferes with the center label, only at most one of them can be present.

center

Label to show at the center. It interferes with the left and right labels.

right

Label to show on the right. It interferes with the center label, only at most one of them can be present.

id

Element id, a string. If NULL, then a new id is generated and returned.

.envir

Environment to evaluate the glue expressions in.

Details

  • "single": (same as 1), a single line,

  • "double": (same as 2), a double line,

  • "bar1", "bar2", "bar3", etc., "bar8" uses varying height bars.

Colors and background colors can similarly changed via a theme, see examples below.

Examples

cli_rule()
#> ────────────────────────────────────────────────────────────────────────────────
cli_text(packageDescription("cli")$Description)
#> A suite of tools to build attractive command line interfaces ('CLIs'), from #> semantic elements: headings, lists, alerts, paragraphs, etc. Supports #> custom themes via a 'CSS'-like language. It also contains a number of lower #> level 'CLI' elements: rules, boxes, trees, and 'Unicode' symbols with #> 'ASCII' alternatives. It integrates with the 'crayon' package to support #> 'ANSI' terminal colors.
cli_rule()
#> ────────────────────────────────────────────────────────────────────────────────
# Theming d <- cli_div(theme = list(rule = list( color = "blue", "background-color" = "darkgrey", "line-type" = "double"))) cli_rule("Left", right = "Right")
#> ── Left ─────────────────────────────────────────────────────────────── Right ──
cli_end(d) # Interpolation cli_rule(left = "One plus one is {1+1}")
#> ── One plus one is 2 ───────────────────────────────────────────────────────────
cli_rule(left = "Package {.pkg mypackage}")
#> ── Package mypackage ───────────────────────────────────────────────────────────