cli environment variables and options

User facing configuration

These are environment variables and options that uses may set, to modify the behavior of cli.

User facing environment variables

Set to posix to force generating POSIX compatible ANSI hyperlinks. If not set, then RStudio compatible links are generated. This is a temporary crutch until RStudio handles POSIX hyperlinks correctly, and after that it will be removed.

NO_COLOR

Set to a nonempty value to turn off ANSI colors. See num_ansi_colors().

ESS_BACKGROUND_MODE

Set this environment variable to light or dark to indicate dark mode in Emacs. Once https://github.com/emacs-ess/ESS/pull/1178 is merged, ESS will set this automatically.

R_CLI_DYNAMIC

Set to true, TRUE or True to assume a dynamic terminal, that supports \r. Set to anything else to assume a non-dynamic terminal. See is_dynamic_tty().

R_CLI_NUM_COLORS

Set to a positive integer to assume a given number of colors. See num_ansi_colors().

Set to true, TRUE or True to tell cli that the terminal supports ANSI hyperlinks. Set to anything else to assume no hyperlink support. See style_hyperlink().

User facing options

cli.ansi

Set to true, TRUE or True to assume a terminal that supports ANSI control sequences. Set to anything else to assume a non-ANSI terminal. See is_ansi_tty().

cli.condition_unicode_bullets

TRUE or FALSE to force turn on or off the Unicode symbols when printing conditions. E.g. in format_error(), format_warning(), format_message() and also in cli_abort(), cli_warn() and cli_inform().

cli.condition_width

Integer scalar (or Inf) to set the console width when cli is formatting errors, warnings or messages in format_error(), format_warning() and format_message(). When formatting conditions this option takes precedence over cli.width.

cli.default_handler

General handler function for all cli conditions. See https://cli.r-lib.org/articles/semantic-cli.html#cli-messages-1

cli.default_num_colors

Default number of ANSI colors. This value is only used if ANSI color support is detected. You can set this value to keep relying on auto-detection, but to adjust the number of colors when cli detects color support. See num_ansi_colors(). See also the cli.num_colors option.

cli.dynamic

Set to TRUE to assume a dynamic terminal, that supports \r. Set to anything else to assume a non-dynamic terminal. See is_dynamic_tty().

cli.hide_cursor

Whether the cli status bar should try to hide the cursor on terminals. Set the FALSE if the hidden cursor causes issues.

Set to true, TRUE or True to tell cli that the terminal supports ANSI hyperlinks. Set to anything else to assume no hyperlink support. See style_hyperlink().

cli.ignore_unknown_rstudio_theme

Set to TRUE to omit a warning for an unknown RStudio theme in code_highlight().

cli.num_colors

Number of ANSI colors. See num_ansi_colors(). See also the cli.default_num_colors option.

cli.message_class

Character vector of classes to add to cli's conditions.

cli.progress_bar_style

Progress bar style. See cli_progress_styles().

cli.progress_bar_style_ascii

Progress bar style on ASCII consoles. See cli_progress_styles().

cli.progress_bar_style_unicode

Progress bar style on Unicode (UTF-8) consoles; See cli_progress_styles().

cli.progress_clear

Whether to clear terminated progress bar from the screen on dynamic terminals. See cli_progress_bar().

cli.progress_demo_live

Whether cli_progress_demo() should show a live demo, or just record the progress bar frames.

cli.progress_format_download

Default format string for download progress bars.

cli.progress_format_download_nototal

Default format string for download progress bars with unknown totals.

cli.progress_format_iterator

Default format string for iterator progress bars.

cli.progress_format_iterator_nototal

Default format string for iterator progress bars with unknown total number of progress units.

cli.progress_format_tasks

Default format string for tasks progress bars.

cli.progress_format_tasks_nototal

Default format string for tasks progress bars with unknown totals.

cli.progress_handlers

Progress handlers to try. See cli_progress_builtin_handlers().

cli.progress_handlers_force

Progress handlers that will always be used, even if another handler was already selected. See cli_progress_builtin_handlers().

cli.progress_handlers_only

Progress handlers to force, ignoring handlers set in cli.progress_handlers and cli.progress_handlers_force. See cli_progress_builtin_handlers().

cli.progress_say_args

Command line arguments for the say progress handlers. See cli_progress_builtin_handlers().

cli.progress_say_command

External command to use in the say progress handler. See cli_progress_builtin_handlers().

cli.progress_say_frequency

Minimum delay between say calls in the say progress handler. say ignores very frequent updates, to keep the speech comprehensible. See cli_progress_builtin_handlers().

cli.progress_show_after

Delay before showing a progress bar, in seconds. Progress bars that finish before this delay are not shown at all. cli also shows progress bars that have more than 50% to go after half of this delay has passed.

cli.spinner

Default spinner to use, see get_spinner().

cli.spinner_ascii

Default spinner to use on ASCII terminals, see get_spinner().

cli.spinner_unicode

Default spinner to use on Unicode terminals, see get_spinner().

cli.theme

Default cli theme, in addition to the built-in theme. This option in intended for the package developers. See themes and start_app().

cli.theme_dark

Whether cli should assume a dark theme for the builtin theme. See builtin_theme().

cli.unicode

Whether to assume a Unicode terminal. If not set, then it is auto-detected. See is_utf8_output().

cli.user_theme

cli user theme. This option is intended for end users. See themes.

cli.warn_inline_newlines

Whether to emit a warning when cli replaces newline characters with spaces within a {.class } inline style. Defaults to FALSE.

cli.width

Terminal width to assume. If not set, then it is auto-detected. See console_width().

rlib_interactive

Whether to assume an interactive R session. If not set, then it is auto-detected.

width

Terminal width. This is used on some platforms, if cli.width is not set.

Internal configuration

These are environment variables and options are for cli developers, users should not rely on them as they may change between cli releases.

Internal environment variables

ASCIICAST

Used to detect an asciicast sub-process in RStudio.

ANSICON

Used to detect ANSICON when detecting the number of ANSI colors.

CI

Used to detect if the code is running on a CI. If yes, we avoid ANSI hyperlinks.

CLI_DEBUG_BAD_END

Whether to warn about cli_end() calls when there is no container to close.

CLI_NO_BUILTIN_THEME

Set it to true to omit the builtin theme.

CLI_SPEED_TIME

Can be used to speed up cli's timer. It is a factor, e.g. setting it to 2 makes cli's time go twice as fast.

CLI_TICK_TIME

How often the cli timer should alert, in milliseconds.

CMDER_ROOT

Used to detect cmder when detecting the number of ANSI colors.

COLORTERM

Used when detecting ANSI color support.

ConEmuANSI

Used to detect ConEmu when detecting the number of ANSI colors.

EMACS

Used to detect Emacs.

INSIDE_EMACS

Used to detect Emacs.

NOT_CRAN

Set to true to run tests / examples / checks, that do not run on CRAN.

_R_CHECK_PACKAGE_NAME_

Used to detect R CMD check.

R_BROWSER

Used to detect the RStudio build pane.

R_GUI_APP_VERSION

Used to detect R.app on macOS, to decide if the console has ANSI control sequences.

R_PACKAGE_DIR

Used to detect if the code is running under R CMD INSTALL.

R_PDFVIEWER

Used to detect the RStudio build pane.

R_PROGRESS_NO_EXAMPLES

Set to true to avoid running examples, outside of R CMD check.

RSTUDIO

Used to detect RStudio, in various functions.

RSTUDIO_CONSOLE_COLOR

Used to detect the number of colors in RStudio. See num_ansi_colors().

RSTUDIO_CONSOLE_WIDTH

Used to auto-detect console width in RStudio.

RSTUDIO_TERM

Used to detect the RStudio build pane.

TEAMCITY_VERSION

Used to detect the TeamCity CI, to turn off ANSI hyperlinks.

TERM

Used to detect if the console has ANSI control sequences, in a terminal.

TERM_PROGRAM

Used to detect iTerm for the dark theme detection and the ANSI hyperlink support detection.

TERM_PROGRAM_VERSION

Used to detect a suitable iTerm version for ANSI hyperlink support.

TESTTHAT

Used to detect running in testthat tests.

VTE_VERSION

Used to detect a suitable VTE version for ANSI hyperlinks.

Internal options

cli__pb

This option is set to the progress bar that is being updated, when interpolating the format string.

cli.record

Internal option to mark the state that cli is recording messages.

crayon.colors

Deprecated option for the number of ANSI colors, that is still supported by cli, when the new options are not set. See num_ansi_colors().

crayon.enabled

Deprecated option to turn ANSI colors on/off. This is still supported by cli when the new options are not set. See num_ansi_colors().

Whether to assume ANSI hyperlink support. See ansi_has_hyperlink_support().

knitr.in.progress

Used to detect knitr when detecting interactive sessions and ANSI color support.

rstudio.notebook.executing

Used to detect knitr when detecting interactive sessions.