cli (development version)
cli_abort()
now supplies.frame
toabort()
. This fixes an issue with the.internal = TRUE
argument (r-lib/rlang#1386).cli now does a better job at detecting the RStudio build pane, job pane and render pane, and their capabilities w.r.t. ANSI colors and hyperlinks. Note that this requires a daily build of RStudio (#465).
New functions for ANSI strings:
ansi_grep()
,ansi_grepl()
,ansi_nzchar()
. They work like the corresponding base R functions, but handle ANSI markup.style_hyperlink()
(really) no longer breaks if the env varibleVTE_VERSION
is of the form\d{4}
, i.e., 4 consecutive numbers (#441, @michaelchirico)cli_dl()
and its correspondingcli_li()
can now style the labels.The behavior cli’s inline styling expressions is now more predictable. cli does not try to evaluate a styled string as an R expression any more. E.g. the meaning of
"{.emph +1}"
is now always the “+1”, with style.emph
, even if an.emph
variable is available and the.emph + 1
expresion can be evaluated.
cli 3.3.0
CRAN release: 2022-04-25
style_hyperlink()
no longer breaks if the env varibleVTE_VERSION
is of the form\d{4}
, i.e., 4 consecutive numbers (#441, @michaelchirico)ansi_*()
functions support ANSI hyperlinks again (#444).Turning off ANSI colors via the
cli.num_colors
option or theR_CLI_NUM_COLORS
or theNO_COLOR
environment variable now also turns off ANSI hyperlinks (#447).symbol
now only has two variants: UTF-8 and ASCII. There are no special variants for RStudio and Windows RGui any more (#424).
cli 3.2.0
CRAN release: 2022-02-14
Breaking change
- The
cli_theme_dark
option is now known ascli.theme_dark
, to be consistent with all other cli option names (#380).
Other changes
The preferred names of the S3 clases
ansi_string
,ansi_style
,boxx
,rule
andtree
now havecli_
prefix:cli_ansi_string
, etc. This will help avoiding name conflicts with other packages eventually, but for now the old names are kept as well, for compatibility.-
cli_abort()
has been updated to work nicely with rlang 1.0. The defaultcall
and backtrace soft-truncation are set to.envir
(which itself is set to the immediate caller ofcli_abort()
by default).Line formatting now happens lazily at display time via
rlang::cnd_message()
(which is called by theconditionMessage()
method for rlang errors). New
hash_sha256()
function to calculate SHA-256 hashes. Newhash_raw_*()
,hash_obj_*()
andhash_file_*()
functions to calculate various hashes of raw vectors, R objects and files.You can use the new
cli.default_num_colors
option to set the default number of ANSI colors, only if ANSI support is otherwise detected. See the details in the manual ofnum_ansi_colors()
.You can set the new
ESS_BACKGROUND_MODE
environment variable todark
to indicate dark mode.cli now handles quotes and comment characters better in the semantion
cli_*()
functions that perform glue string interpolation (#370).
cli 3.1.0
CRAN release: 2021-10-27
Breaking changes
- The C progress bar API now uses
double
instead ofint
as the data type of the progress units (#335).
New features
-
Several improvements and changes in the
ansi_*()
functions:- most
ansi_*()
functions are now implemented in C and they are much faster (#316). - they handle
NA
values better. - many functions now use UTF-8 graphemes by default instead of code points. E.g.
ansi_nchar()
counts graphemes, etc. - they convert their input to UTF-8 and always return UTF-8 encoded strings.
- new function
ansi_simplify()
to remove superfluous ANSI tags. - new function
ansi_html()
to convert ANSI-highlighted strings to HTML. -
ansi_has_any()
andansi_strip()
now havesgr
andcsi
arguments to look for SGR tags, CSI tags, or both.
- most
New functions that handle UTF-8 encoded strings correctly:
utf8_graphemes()
,utf8_nchar()
,utf8_substr()
.Support for palettes, including a colorblind friendly palette. See
?ansi_palettes
for details.True color support:
num_ansi_colors()
now detects terminals with 24 bit color support, andmake_ansi_style()
uses the exact RGB colors on these terminals (#208).The new
col_br_*()
andbg_br_()
functions create bright versions of eight base ANSI colors (#327).New function
code_highlight()
to syntax highlight R code. It supports several themes out of the box, seecode_theme_list()
(#348).New functions for hashing:
hash_animal()
,hash_emoji()
andhash_md5()
.New
diff_chr()
anddiff_str()
functions to calculate the difference of character vectors and letters of strings.
Smaller improvements
Progress bars with
clear = FALSE
now print the last, completed, state properly.The progress bar for Shiny apps now handles output from
cli_progress_output()
.Progress variables in C
format_done
strings work correctly now (#337).cli_dl()
now works with an empty description, and gives a better error for invalid input (#347).rule()
is now works better if the labels have ANSI markup.cli_process_done()
now does not error without a process (#351).ANSI markup is now supported in RStudio jobs (#353).
The lack of ANSI support is now again correctly detected if there is an active
sink()
(#366).
cli 3.0.1
CRAN release: 2021-07-17
ansi_strtrim()
now correctly keepsNA
values (#309).format_inline()
now uses the correct environment (@rundel, #314).
cli 3.0.0
CRAN release: 2021-06-30
New functions for progress bars, please see the new articles at https://cli.r-lib.org/articles/ for details.
New
cli_abort()
,cli_warn()
andcli_inform()
functions, to throw errors with cli pluralization and styling.New
format_inline()
function to format a cli string without emitting it (#278).
cli 2.5.0
CRAN release: 2021-04-26
New
style_no_*()
functions to locally undo styling. Newcol_none()
andbg_none()
functions to locally undo text color and background color.It is now possible to undo text and background color in a theme, by setting them to
NULL
or"none"
.cli_memo()
was renamed tocli_bullets()
, as it is by default formatted as a bullet list (#250).New
ansi_toupper()
,ansi_tolower
andansi_chartr()
functions, the ANSI styling aware variants oftoupper()
,tolower()
andchartr()
(#248).New
test_that_cli()
helper function to write testthat tests for cli output.New inline style:
.cls
to format class names, e.g."{.var fit} must be an {.cls lm} object"
.
cli 2.4.0
CRAN release: 2021-04-05
New
cli_memo()
function to create a list of items or tasks.New
cli::cli()
function to create a single cli message from multiple cli calls (#170).cli now highlights weird names, e.g. path names with leading or trailing space (#227).
Styling is fixed at several places. In particular, nested lists should be now formatted better (#221).
New
spark_bar()
andspark_line()
functions to draw small bar or line charts.
cli 2.3.0
CRAN release: 2021-01-31
boxx()
now correctly calculates the width of the box for non-ASCII characters.New
ansi_trimws()
andansi_strwrap()
functions, they are similar totrimws()
andstrwrap()
but work on ANSI strings.New
ansi_columns()
function to format ANSI strings in multiple columns.ansi_substr()
,ansi_substring()
,ansi_strsplit()
,ansi_align()
now always returncli_ansi_string
objects.ansi_nchar()
,ansi_align()
,ansi_strtrim()
and the newansi_strwrap()
as well handle wide Unicode correctly, according to their display width.boxx()
can now add headers and footers to boxes.
cli 2.2.0
CRAN release: 2020-11-20
New
style_hyperlink()
function to add hyperlinks, on terminals that support them.cli_format_method()
now works properly in knitr, and other environments that catch message conditions (#159).ANSI strings created by
col_*
,bg_*
andstyle_*
now also add thecharacter
class to the result. This fixes issues with code that expectcharacter
objects.New functions to manipulate ANSI strings:
ansi_aling()
,ansi_has_any()
,ansi_nchar()
,ansi_regex()
,ansi_strip()
,ansi_strsplit()
,ansi_substr()
,ansi_substring()
.
cli 2.1.0
CRAN release: 2020-10-12
New
cli_vec()
function to allow easier formatting of collapsed vectors. It is now also possible to use styling to set the collapsing parameters (#129).New
pluralize()
function to perform pluralization without generating cli output (#155).console_width()
works better now in RStudio, and also in terminals.Styling of verbatim text work properly now (#147, @tzakharko).
Messages (i.e.
message
conditions) coming from cli now have thecliMessage
class, so you can easily suppress them without suppressing other messages (#156).cli prints the output to
stderr()
now, if there is an output or message sink. This is to make interactive and non-interactive sessions consistent (#153).Pluralization works correctly now if the last alternative is the empty string (#158).
cli now caches the result of the dark background detection in iTerm on macOS. Reload cli to delete the cache (#131).
The
is_dynamic_tty()
,is_ansi_tty()
andansi_hide_cursor()
and related functions now default to the"auto"
stream, which is automatically selected to be eitherstdout()
orstderr()
. See the manual for details (#144).The default theme now quotes file names, paths, email addresses if they don’t start or end with an alphanumeric character or a slash. This is to make it easier to spot names that start or end with a space (#167).
make_spinner()
clears the line properly now (@tzakharko, #164).Semantic cli functions now automatically replace Unicode non-breaking space characters (
\u00a0
) with regular space characters, right before output. They are still used to calculate the line breaks, but not outputted (#161).Progress bars now respect
is_dynamic_tty()
and do not output\r
when this is false (@jimhester, #177)
cli 2.0.2
CRAN release: 2020-02-28
The status bar now does not simplify multiple spaces by a single space.
cli now does not crash if it fails to detect whether the RStudio theme is a dark theme (#138).
cli now works better with wide Unicode characters, for example emojis. In particular, a status bar containing emojis is cleared properly (#133).
The status bar now does not flicker when updated, in terminals (#135).
cli 2.0.1
CRAN release: 2020-01-08
Symbols (
symbol$*
) are now correctly printed in RStudio on Windows (#124).The default theme for
cli_code()
output looks better now, especially in RStudio (#123).Remove spurious newline after a
cli_process_start()
was cleared manually, and also at the end of the function.Use Oxford comma when listing 3 or more items (@jonocarroll, #128).
cli 2.0.0
CRAN release: 2019-12-09
Semantic command line interface tools
cli 2.0.0 has a new set of functions that help creating a CLI using a set of higher level elements: headings, paragraphs, lists, alerts, code blocks, etc. The formatting of all elements can be customized via themes. See the “Building a semantic CLI” article on the package web site: https://cli.r-lib.org
Bug fixes:
- Fix a bug in
is_dynamic_tty()
, settingR_CLI_DYNAMIC="FALSE"
now properly turns dynamic tty off (#70).
cli 1.1.0
CRAN release: 2019-03-19
cli has now functions to add ANSI styles to text. These use the crayon package internally, and provide a simpler interface. See the
col_*
,bg_*
,style_*
and also themake_ansi_style()
andcombine_ansi_styles()
functions (#51).New
is_dynamic_tty()
function detects if\r
should be used for a stream (#62).New
is_ansi_tty()
function detects if ANSI control sequences can be used for a stream.New
ansi_hide_cursor()
,ansi_show_cursor()
andansi_with_hidden_cursor()
functions to hide and show the cursor in terminals.New
make_spinner()
function helps integrating spinners into your functions.Now
symbol
always uses ASCII symbols when thecli.unicode
option is set toFALSE
.