code_highlight() supports long strings and symbols(#727Pluralization now handles edge cases (NA,NaN,Inf and-Inf) better (
The URI generated for.file,.run,.help and.vignette hyperlinks can now beconfigured via options and env vars (
cli_progress_bar() now acceptstotal =Inf or -Inf which mimics the behavior of whentotal is NA(@LouisMPenrod,#630).
num_ansi_colors() now does not warn in Emacs if theINSIDE_EMACS environment variable is not a proper versionnumber (@rundel,#689).
ansi_collapse() and inline collapsing now useslast as the separator (without the serial comma) fortwo-element vectors ifsep2 is not given (
ansi_collapse() is now correct for length-1 vectorswith style “head” if width is specified (
Newhash_xxhash() etc. functions to calculate thexxHash of strings, raw vectors, objects, files.
cli now builds on ARM Windows.
“Solarized Dark” is now the default syntax highlighting theme interminals.
The{.obj_type_friendly} inline style now only showsthe first class name (#669
Syntax highlighting now does not fail in RStudio if therstudioapi package is not installed (#697).
ansi_collapse(x, trunc = 1, style = "head") nowindeed shows one element iflength(x) == 2, as documented(@salim-b,#572).
ansi_collapse() gains asep2 argumentto specify a seperate separator for length-two inputs. It defaults to" and " which, in conjunction with the other defaults,produces a collapsed string that fully adheres to theserial commarules. (@salim-b,#569)
ansi_string() is now an exported function (
The progressr progress handler now reports progress correctly(
Newhash_*sha1() functions to calculate the SHA-1hash of strings, objects, files.
cli now shows progress bars after one second by default, if theyare less than half way at the point. (Or after two seconds,unconditionally, as before.) See the thecli.progress_show_after option in?cli-configfor details (#542).
format_inline() now has a new argumentkeep_whitespace, and it keeps whitespace, including newlineand form feed characters by default.
Newkeypress() function to read a single key pressfrom a terminal.
New functionpretty_print_code() to print functionobjects with syntax highlighting at the R console.
col_* andbg_* functions how handlezero-length input correctly (#532).
New functionansi_collapse() to collapse charactervectors into a single string.
ansi_strtrim() now handles some edge cases better,whenellipsis has length zero, and when it is wider thanwidth.
Newhash_file_md5() function to calculate the MD5hash of one or more files.
cli has better error messages now.
Newformat_inline() argument:collapse,to collapse multi-line output, potentially because of\fcharacters.
New experimental styles to create ANSI hyperlinks in RStudio andterminals that support them. See?cli::links for details(#513).
Expressions that start and end with a{}substitution are now styled correctly. E.g.{.code {var1} + {var2}} (#517).
New{.obj_type_friendly} inline style to format thetype of an R object in a user friendly way (#463).
Improved vector collapsing behavior. cli now shows both thebeginning and end of the collapsed vector, by default (#419).
Nestedcli() calls work now (#497).
Return values now work as they should withincli()calls (#496).
Style attributes with underscores have new names with dashesinstead:vec_sep,vec_last,vec_trunc,string-quote. The old names stillwork, but the new ones take precedence (#483).
cli now does not crash at the end of the R session on Arm Windows(#494;
Vectors are truncated at 20 elements now by default, instead of100 (#430).
20 new spinners from the awesomecli-spinnerspackage, and from
new<-c("dots13","dots8Bit","sand","material","weather","christmas","grenade","point","layer","betaWave","fingerDance","fistBump","soccerHeader","mindblown","speaker","orangePulse","bluePulse","orangeBluePulse","timeTravel","aesthetic","growVeriticalDotsLR","growVeriticalDotsRL","growVeriticalDotsLL","growVeriticalDotsRR")demo_spinners(new)cli exit handlers are now compatible again with the withr package(#437).
cli functions now keep trailing\f characters asnewlines. They also keep multiple consecutive\f asmultiple newlinees (#491).
{} substitutions within inline styles are nowformatted correctly. E.g.{.code download({url})} will notadd backticks tourl, and{.val pre-{x}-post}will format the whole value instead ofx. (#422,#474).
cli now replaces newline characters within{.class ... } inline styles with spaces. If thecli.warn_inline_newlines option is set to TRUE, then italso throws a warning. (#417).
code_highlight now falls back to the default theme(instead of no theme) for unknown RStudio themes (#482,
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 andhyperlinks. Note that this requires a daily build of RStudio(#465).
New functions for ANSI strings:ansi_grep(),ansi_grepl(),ansi_nzchar(). They work likethe corresponding base R functions, but handle ANSI markup.
style_hyperlink() (really) no longer breaks if theenv variableVTE_VERSION is of the form\d{4},i.e., 4 consecutive numbers (#441,
cli_dl() and its correspondingcli_li()can now style the labels.
The behavior cli’s inline styling expressions is now morepredictable. cli does not try to evaluate a styled string as an Rexpression any more. E.g. the meaning of"{.emph +1}" isnow always the “+1”, with style.emph, even if an.emph variable is available and the.emph + 1expression can be evaluated.
Functions that apply bright background colors(e.g. bg_br_yellow()) now close themselves. They no longerformat text after the end of the function (#484,
style_hyperlink() no longer breaks if the envvariableVTE_VERSION is of the form\d{4},i.e., 4 consecutive numbers (#441,
ansi_*() functions support ANSI hyperlinks again(#444).
Turning off ANSI colors via thecli.num_colorsoption or theR_CLI_NUM_COLORS or theNO_COLORenvironment 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_theme_dark option is now known ascli.theme_dark, to be consistent with all other cli optionnames (#380).The preferred names of the S3 classesansi_string,ansi_style,boxx,rule andtree now havecli_ prefix:cli_ansi_string, etc. This will help avoiding nameconflicts with other packages eventually, but for now the old names arekept as well, for compatibility.
cli_abort() has been updated to work nicely withrlang 1.0. The defaultcall and backtrace soft-truncationare set to.envir (which itself is set to the immediatecaller ofcli_abort() by default).
Line formatting now happens lazily at display time viarlang::cnd_message() (which is called by theconditionMessage() method for rlang errors).
Newhash_sha256() function to calculate SHA-256hashes. Newhash_raw_*(),hash_obj_*() andhash_file_*() functions to calculate various hashes of rawvectors, R objects and files.
You can use the newcli.default_num_colors option toset the default number of ANSI colors, only if ANSI support is otherwisedetected. See the details in the manual ofnum_ansi_colors().
You can set the newESS_BACKGROUND_MODE environmentvariable todark to indicate dark mode.
cli now handles quotes and comment characters better in thesemantioncli_*() functions that perform glue stringinterpolation (#370).
style_hyperlink() gains aparams= argument(#384).double instead ofint as the data type of the progress units (#335).Several improvements and changes in theansi_*()functions:
ansi_*() functions are now implemented in C andthey are much faster (#316).NA values better.ansi_nchar() counts graphemes, etc.ansi_simplify() to remove superfluous ANSItags.ansi_html() to convert ANSI-highlightedstrings to HTML.ansi_has_any() andansi_strip() now havesgr andcsi arguments to look for SGR tags,CSI tags, or both.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 detectsterminals with 24 bit color support, andmake_ansi_style()uses the exact RGB colors on these terminals (#208).
The newcol_br_*() andbg_br_()functions create bright versions of eight base ANSI colors(#327).
New functioncode_highlight() to syntax highlight Rcode. It supports several themes out of the box, seecode_theme_list() (#348).
New functions for hashing:hash_animal(),hash_emoji() andhash_md5().
Newdiff_chr() anddiff_str() functionsto calculate the difference of character vectors and letters ofstrings.
Progress bars withclear = FALSE now print the last,completed, state properly.
The progress bar for Shiny apps now handles output fromcli_progress_output().
Progress variables in Cformat_done strings workcorrectly now (#337).
cli_dl() now works with an empty description, andgives a better error for invalid input (#347).
rule() is now works better if the labels have ANSImarkup.
cli_spark objects now haveformat() andprint() methods.
cli_process_done() now does not error without aprocess (#351).
ANSI markup is now supported in RStudio jobs (#353).
The lack of ANSI support is now again correctly detected if thereis an activesink() (#366).
ansi_strtrim() now correctly keepsNAvalues (#309).
format_inline() now uses the correct environment(@rundel,#314).
New functions for progress bars, please see the new articles athttps://cli.r-lib.org/articles/ for details.
Newcli_abort(),cli_warn() andcli_inform() functions, to throw errors with clipluralization and styling.
Newformat_inline() function to format a cli stringwithout emitting it (#278).
Newstyle_no_*() functions to locally undo styling.Newcol_none() andbg_none() functions tolocally undo text color and background color.
It is now possible to undo text and background color in a theme,by setting them toNULL or"none".
cli_memo() was renamed tocli_bullets(), as it is by default formatted as a bulletlist (#250).
Newansi_toupper(),ansi_tolower andansi_chartr() functions, the ANSI styling aware variants oftoupper(),tolower() andchartr()(#248).
Newtest_that_cli() helper function to writetestthat tests for cli output.
tree() now does not produce warnings for tibbles(#238).
New inline style:.cls to format class names, e.g."{.var fit} must be an {.cls lm} object".
Newcli_memo() function to create a list of items ortasks.
Newcli::cli() function to create a single climessage from multiple cli calls (#170).
cli now highlights weird names, e.g. path names with leading ortrailing space (#227).
Styling is fixed at several places. In particular, nested listsshould be now formatted better (#221).
Newspark_bar() andspark_line()functions to draw small bar or line charts.
ANSI color support detection works correctly now in olderRStudio, and also on older R versions.
cli_h1(),cli_h2() andcli_h3() now work with multiple glue substitutions(#218).
boxx() now correctly calculates the width of the boxfor non-ASCII characters.
Newansi_trimws() andansi_strwrap()functions, they are similar totrimws() andstrwrap() but work on ANSI strings.
Newansi_columns() function to format ANSI stringsin multiple columns.
ansi_substr(),ansi_substring(),ansi_strsplit(),ansi_align() now alwaysreturncli_ansi_string objects.
ansi_nchar(),ansi_align(),ansi_strtrim() and the newansi_strwrap() aswell handle wide Unicode correctly, according to their displaywidth.
boxx() can now add headers and footers toboxes.
Newstyle_hyperlink() function to add hyperlinks, onterminals that support them.
cli_format_method() now works properly in knitr, andother environments that catch message conditions (#159).
ANSI strings created bycol_*,bg_* andstyle_* now also add thecharacter class tothe 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().
Newcli_vec() function to allow easier formatting ofcollapsed vectors. It is now also possible to use styling to set thecollapsing parameters (#129).
Newpluralize() function to perform pluralizationwithout generating cli output (#155).
console_width() works better now in RStudio, andalso in terminals.
Styling of verbatim text work properly now (#147,
Messages (i.e. message conditions) coming from clinow have thecliMessage class, so you can easily suppressthem without suppressing other messages (#156).
cli prints the output tostderr() now, if there isan output or message sink. This is to make interactive andnon-interactive sessions consistent (#153).
Pluralization works correctly now if the last alternative is theempty string (#158).
cli now caches the result of the dark background detection iniTerm on macOS. Reload cli to delete the cache (#131).
Theis_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 fordetails (#144).
The default theme now quotes file names, paths, email addressesif 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 (
Semantic cli functions now automatically replace Unicodenon-breaking space characters (\u00a0) with regular spacecharacters, right before output. They are still used to calculate theline breaks, but not outputted (#161).
Progress bars now respectis_dynamic_tty() and donot output\r when this is false (
The status bar now does not simplify multiple spaces by a singlespace.
cli now does not crash if it fails to detect whether the RStudiotheme is a dark theme (#138).
cli now works better with wide Unicode characters, for exampleemojis. In particular, a status bar containing emojis is clearedproperly (#133).
The status bar now does not flicker when updated, in terminals(#135).
Symbols (symbol$*) are now correctly printed inRStudio on Windows (#124).
The default theme forcli_code() output looks betternow, especially in RStudio (#123).
Remove spurious newline after acli_process_start()was cleared manually, and also at the end of the function.
Use Oxford comma when listing 3 or more items (
cli 2.0.0 has a new set of functions that help creating a CLI using aset of higher level elements: headings, paragraphs, lists, alerts, codeblocks, etc. The formatting of all elements can be customized viathemes. See the “Building a semantic CLI” article on the package website: https://cli.r-lib.org
is_dynamic_tty(), settingR_CLI_DYNAMIC="FALSE" now properly turns dynamic tty off(#70).cli has now functions to add ANSI styles to text. These use thecrayon package internally, and provide a simpler interface. See thecol_*,bg_*,style_* and also themake_ansi_style() andcombine_ansi_styles()functions (#51).
Newis_dynamic_tty() function detects if\r should be used for a stream (#62).
Newis_ansi_tty() function detects if ANSI controlsequences can be used for a stream.
Newansi_hide_cursor(),ansi_show_cursor() andansi_with_hidden_cursor() functions to hide and show thecursor in terminals.
Newmake_spinner() function helps integratingspinners into your functions.
Nowsymbol always uses ASCII symbols when thecli.unicode option is set toFALSE.
Newcli_sitrep() function, situation report aboutUTF-8 and ANSI color support (#53).
Fall back to ASCII only characters on non-Windows platformswithout UTF-8 support, and also in LaTeX when running knitr(#34).
First public release.