A suite of tools to build attractive command line interfaces (CLIs),
from semantic elements: headers, lists, alerts, paragraphs, etc.
Supports theming 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 supports ANSI markup for terminal colors and font
styles.
Features
Build a CLI using semantic elements: headings, lists, alerts,
paragraphs.
Theming via a CSS-like language.
Terminal colors and font styles.
All cli text can contain interpreted string literals, via the
glue package.
Progress bars from R and C code.
Error and warning messages with rich text formatting.
Support for pluralized messages.
ANSI styled string manipulation.
Installation
Install the stable version from CRAN:
install.packages("cli")
Install the development version from GitHub:
pak::pak("r-lib/cli")
Short tour
Some of the more commonly used cli elements, and features.
fun <- function() {
cli_div(theme = list(span.emph = list(color = "orange")))
cli_text("This is very {.emph important}")
cli_end()
cli_text("Back to the {.emph previous theme}")
}
fun()
Command substitution
Automatic command substitution via the
glue package.
cli
A suite of tools to build attractive command line interfaces (CLIs), from semantic elements: headers, lists, alerts, paragraphs, etc. Supports theming 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 supports ANSI markup for terminal colors and font styles.
Features
Installation
Install the stable version from CRAN:
Install the development version from GitHub:
Short tour
Some of the more commonly used cli elements, and features.
Short alert messages
One liner messages to inform or warn.
Headings
Three levels of headings.
Lists
Ordered, unordered and description lists, that can be nested.
Themes
Theming via a CSS-like language.
Command substitution
Automatic command substitution via the glue package.
Pluralization
Pluralization support.
Progress bars
Documentation
See at
https://cli.r-lib.org/and also in the installed package:help(package = "cli").Code of Conduct
Please note that the cli project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
License
MIT © Posit Software, PBC