Function reference
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
-
links
- cli hyperlinks
-
containers
- About cli containers
-
themes
- About cli themes
-
pluralization
- About cli pluralization
-
cli()
- Compose multiple cli functions
-
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_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
- 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
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.
-
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
cli__pb_bar
pb_bar
cli__pb_current
pb_current
cli__pb_current_bytes
pb_current_bytes
cli__pb_elapsed
pb_elapsed
cli__pb_elapsed_clock
pb_elapsed_clock
cli__pb_elapsed_raw
pb_elapsed_raw
cli__pb_eta
pb_eta
cli__pb_eta_raw
pb_eta_raw
cli__pb_eta_str
pb_eta_str
cli__pb_extra
pb_extra
cli__pb_id
pb_id
cli__pb_name
pb_name
cli__pb_percent
pb_percent
cli__pb_pid
pb_pid
cli__pb_rate
pb_rate
cli__pb_rate_raw
pb_rate_raw
cli__pb_rate_bytes
pb_rate_bytes
cli__pb_spin
pb_spin
cli__pb_status
pb_status
cli__pb_timestamp
pb_timestamp
cli__pb_total
pb_total
cli__pb_total_bytes
pb_total_bytes
- Progress bar variables
-
progress-c
- The cli progress C API
-
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.
-
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()
ansi_hyperlink_types()
- Terminal Hyperlinks
-
combine_ansi_styles()
- Combine two or more ANSI styles
-
make_ansi_style()
- Create a new ANSI style
-
ansi_align()
- Align an ANSI colored string
-
ansi_collapse()
- Collapse a vector into a string scalar
-
ansi_columns()
- Format a character vector in multiple columns
-
ansi_grep()
ansi_grepl()
- Like
base::grep()
andbase::grepl()
, but for ANSI strings
-
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_nzchar()
- Like
base::nzchar()
, but for ANSI strings
-
ansi_regex()
- Perl compatible regular expression that matches ANSI escape sequences
-
ansi_simplify()
- Simplify ANSI styling tags
-
ansi_string()
- Labels a character vector as containing ANSI control codes.
-
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
-
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
-
code_highlight()
- Syntax highlight R code
-
code_theme_list()
- Syntax highlighting themes
-
pretty_print_code()
- Turn on pretty-printing functions at the R console
-
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
-
hash_animal()
hash_raw_animal()
hash_obj_animal()
- Adjective-animal hash
-
hash_emoji()
hash_raw_emoji()
hash_obj_emoji()
- Emoji hash
-
cli-config
- cli environment variables and options
-
cli_debug_doc()
- Debug cli internals
-
cli_fmt()
- Capture the output of cli functions instead of printing it
-
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
-
has_keypress_support()
- Check if the current platform/terminal supports reading single keys.
-
is_dynamic_tty()
- Detect whether a stream supports
\\r
(Carriage return)
-
is_utf8_output()
- Whether cli is emitting UTF-8 characters
-
keypress()
- Read a single keypress at the terminal
-
ruler()
- Print the helpful ruler to the screen
-
test_that_cli()
- Test cli output with testthat
-
vt_output()
- Simulate (a subset of) a VT-5xx ANSI terminal
-
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)