cli_rule: CLI horizontal rule

View source: R/cli.R

cli_ruleR Documentation

CLI horizontal rule

Description

It can be used to separate parts of the output.

Usage

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

Inline styling and interpolation

pkg <- "mypackage"
cli_rule(left = "{.pkg {pkg}} results")
#> ── mypackage results ─────────────────────────────────────────────────          

Theming

The line style of the rule can be changed via the the line-type property. Possible values are:

  • "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.

d <- cli_div(theme = list(rule = list(
  color = "cyan",
  "line-type" = "double")))
cli_rule("Summary", right = "{.pkg mypackage}")
cli_end(d)
#> ══ Summary ══════════════════════════════════════════════ mypackage ══          

See Also

This function supports inline markup.

Other functions supporting inline markup: cli_abort(), cli_alert(), cli_blockquote(), cli_bullets_raw(), cli_bullets(), 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_status_update(), cli_status(), cli_text(), cli_ul(), format_error(), format_inline()


cli documentation built on June 22, 2024, 10:57 a.m.