Introduction

To learn how to use cli’s semantic markup, start with the ‘Building a semantic CLI’ vignette.

More detailed summaries about various cli topics:

inline-markup

About inline markup in the semantic cli

containers

About cli containers

themes

About cli themes

pluralization

About cli pluralization

Semantic CLI Elements

cli()

Compose multiple cli functions

cli_alert() cli_alert_success() cli_alert_danger() cli_alert_warning() cli_alert_info()

CLI alerts

cli_blockquote()

CLI block quote

cli_bullets()

List of items

cli_bullets_raw() format_bullets_raw()

List of verbatim items

cli_code()

A block of code

cli_div()

Generic CLI container

cli_dl()

Definition list

cli_end()

Close a CLI container

cli_format()

Format a value for printing

cli_h1() cli_h2() cli_h3()

CLI headings

cli_li()

CLI list item(s)

cli_ol()

Ordered CLI list

cli_par()

CLI paragraph

cli_rule()

CLI horizontal rule

cli_text()

CLI text

cli_ul()

Unordered CLI list

cli_vec()

Add custom cli style to a vector

cli_verbatim()

CLI verbatim text

format_inline()

Format and returns a line of text

Themes

themes

About cli themes

builtin_theme()

The built-in CLI theme

simple_theme()

A simple CLI theme

cli_list_themes()

List the currently active themes

Pluralization

cli has tools to create messages that are printed correctly in singular and plural forms. See the ‘Pluralization’ article for an introduction.

pluralize()

String templating with pluralization

no() qty()

Pluralization helper functions

Progress bars

cli progress bars work well with other bits of the semantic cli API. See the ‘Introduction to Progress Bars in cli’ article for an introduction, and the ‘Advanced cli Progress Bars’ article for more advanced topics.

Create and update progress bars

cli_progress_along()

Add a progress bar to a mapping function or for loop

cli_progress_bar() cli_progress_update() cli_progress_done()

cli progress bars

cli_progress_message()

Simplified cli progress messages

cli_progress_output()

Add text output to a progress bar

cli_progress_step()

Simplified cli progress messages, with styling

progress-variables

Progress bar variables

Progress bars in C/C++

progress-c

The cli progress C API

Progress bar utilities

cli_progress_builtin_handlers()

cli progress handlers

cli_progress_demo()

cli progress bar demo

cli_progress_styles()

List of built-in cli progress styles

cli_progress_num() cli_progress_cleanup()

Progress bar utility functions.

Terminal Colors and Styles

truecolor ansi_palettes ansi_palette_show()

ANSI colors palettes

num_ansi_colors() detect_tty_colors()

Detect the number of ANSI colors to use

bg_black() bg_blue() bg_cyan() bg_green() bg_magenta() bg_red() bg_white() bg_yellow() bg_none() bg_br_black() bg_br_blue() bg_br_cyan() bg_br_green() bg_br_magenta() bg_br_red() bg_br_white() bg_br_yellow() col_black() col_blue() col_cyan() col_green() col_magenta() col_red() col_white() col_yellow() col_grey() col_silver() col_none() col_br_black() col_br_blue() col_br_cyan() col_br_green() col_br_magenta() col_br_red() col_br_white() col_br_yellow() style_dim() style_blurred() style_bold() style_hidden() style_inverse() style_italic() style_reset() style_strikethrough() style_underline() style_no_bold() style_no_blurred() style_no_dim() style_no_italic() style_no_underline() style_no_inverse() style_no_hidden() style_no_strikethrough() style_no_color() style_no_bg_color()

ANSI colored text

style_hyperlink() ansi_has_hyperlink_support()

Terminal Hyperlinks

combine_ansi_styles()

Combine two or more ANSI styles

make_ansi_style()

Create a new ANSI style

ANSI and/or UTF-8 String Manipulation

ansi_align()

Align an ANSI colored string

ansi_columns()

Format a character vector in multiple columns

ansi_has_any()

Check if a string has some ANSI styling

ansi_html()

Convert ANSI styled text to HTML

ansi_html_style()

CSS styles for the output of ansi_html()

ansi_nchar()

Count number of characters in an ANSI colored string

ansi_regex()

Perl compatible regular expression that matches ANSI escape sequences

ansi_simplify()

Simplify ANSI styling tags

ansi_strip()

Remove ANSI escape sequences from a string

ansi_strsplit()

Split an ANSI colored string

ansi_strtrim()

Truncate an ANSI string

ansi_strwrap()

Wrap an ANSI styled string to a certain width

ansi_substr()

Substring(s) of an ANSI colored string

ansi_substring()

Substring(s) of an ANSI colored string

ansi_toupper() ansi_tolower() ansi_chartr()

ANSI character translation and case folding

ansi_trimws()

Remove leading and/or trailing whitespace from an ANSI string

utf8_graphemes()

Break an UTF-8 character vector into grapheme clusters

utf8_nchar()

Count the number of characters in a character vector

utf8_substr()

Substring of an UTF-8 string

Format and signal errors with cli formatting

cli_abort() cli_warn() cli_inform()

Signal an error, warning or message with a cli formatted message

format_error() format_warning() format_message()

Format an error, warning or diagnostic message

Rules, Boxes, Trees, Spinners, etc.

This section documents cli functions that create various non-semantic cli output. See the ‘Rules, Boxes and Trees’ article for a quick overiew of most of them.

list_border_styles() boxx()

Draw a banner-like box in the console

demo_spinners()

Show a demo of some (by default all) spinners

get_spinner()

Character vector to put a spinner on the screen

list_spinners()

List all available spinners

symbol list_symbols()

Various handy symbols to use in a command line UI

make_spinner()

Create a spinner

rule()

Make a rule with one or two text labels

spark_bar()

Draw a sparkline bar graph with unicode block characters

spark_line()

Draw a sparkline line graph with Braille characters.

tree()

Draw a tree

Syntax Highlighting

code_highlight()

Syntax highlight R code

code_theme_list()

Syntax highlighting themes

ANSI Control Sequences

is_ansi_tty()

Detect if a stream support ANSI escape characters

ansi_hide_cursor() ansi_show_cursor() ansi_with_hidden_cursor()

Hide/show cursor in a terminal

Utilities and Configuration

cat_line() cat_bullet() cat_boxx() cat_rule() cat_print()

cat() helpers

cli-config

cli environment variables and options

cli_debug_doc()

Debug cli internals

cli_format_method()

Create a format method for an object using cli tools

cli_output_connection()

The connection option that cli would use

cli_sitrep()

cli situation report

console_width()

Determine the width of the console

start_app() stop_app() default_app()

Start, stop, query the default cli application

diff_chr()

Compare two character vectors elementwise

diff_str()

Compare two character strings, character by character

hash_animal()

Adjective-animal hash

hash_emoji()

Emoji hash

hash_md5()

MD5 hash

is_dynamic_tty()

Detect whether a stream supports \\r (Carriage return)

is_utf8_output()

Whether cli is emitting UTF-8 characters

test_that_cli()

Test cli output with testthat

Superseded functions

cli_process_start() cli_process_done() cli_process_failed()

Indicate the start and termination of some computation in the status bar (superseded)

cli_status()

Update the status bar (superseded)

cli_status_clear()

Clear the status bar (superseded)

cli_status_update()

Update the status bar (superseded)