Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli.user_theme has no effect on abort and friends #1766

Open
thothal opened this issue Dec 3, 2024 · 7 comments
Open

cli.user_theme has no effect on abort and friends #1766

thothal opened this issue Dec 3, 2024 · 7 comments

Comments

@thothal
Copy link

thothal commented Dec 3, 2024

Crosspost

I originally asked this question on Stackoverflow, but as I simply copied and pasted the official documents on condition customization I think it is indeed an issue (either with the docs or the code).

Problem

I tried to customize the look and feel of the condition messages but to not avail. I followed word by word the docs but in both the native R console and the RStudio console I still see the default bullets despite my efforts to change them to * (or its Unicode equivalent for all it matters):

options(cli.user_theme = list(
  ".cli_rlang .bullet-*" = list(before = "* "),
  ".cli_rlang .bullet-i" = list(before = "* "),
  ".cli_rlang .bullet-x" = list(before = "* "),
  ".cli_rlang .bullet-v" = list(before = "* "),
  ".cli_rlang .bullet->" = list(before = "* ")
))

rlang::abort(c(
  "The error message.",
  "*" = "Regular bullet.",
  "i" = "Informative bullet.",
  "x" = "Cross bullet.",
  "v" = "Victory bullet.",
  ">" = "Arrow bullet."
))

Result

R Console

image

RStudio Console

image

Expected Results

I would expect to see * (or its Unicode equivalent) as bullet for all bullets.

Session Info

─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.4.1 (2024-06-14 ucrt)
 os       Windows 10 x64 (build 19045)
 system   x86_64, mingw32
 ui       Rgui
 language EN
 collate  German_Germany.utf8
 ctype    German_Germany.utf8
 tz       Europe/Berlin
 date     2024-12-02
 pandoc   3.2 @ <Path 1>

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 cli           3.6.3   2024-06-21 [1] CRAN (R 4.4.2)
 rlang         1.1.4   2024-06-04 [1] CRAN (R 4.4.2)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.4.1)

 [1] <Path 2>
 [2] <Path 3>

──────────────────────────────────────────────────────────────────────────────
@lionel-
Copy link
Member

lionel- commented Dec 6, 2024

cli::cli_abort() should fill in this gap. Does it work as you expect?

@thothal
Copy link
Author

thothal commented Dec 6, 2024

Nope, unfortunately same output:

options(cli.user_theme = list(
  ".cli_rlang .bullet-*" = list(before = "* "),
  ".cli_rlang .bullet-i" = list(before = "* "),
  ".cli_rlang .bullet-x" = list(before = "* "),
  ".cli_rlang .bullet-v" = list(before = "* "),
  ".cli_rlang .bullet->" = list(before = "* ")
))


cli::cli_abort(c(
"The error message.",
  "*" = "Regular bullet.",
  "i" = "Informative bullet.",
  "x" = "Cross bullet.",
  "v" = "Victory bullet.",
  ">" = "Arrow bullet."
))
#> Error:
#> ! The error message.
#> * Regular bullet.
#> i Informative bullet.
#> x Cross bullet.
#> v Victory bullet.
#> > Arrow bullet.

Created on 2024-12-06 with reprex v2.1.1

@lionel- lionel- transferred this issue from r-lib/rlang Dec 6, 2024
@lionel-
Copy link
Member

lionel- commented Dec 6, 2024

I think this is an issue in cli? I just transferred your issue.

@gaborcsardi
Copy link
Member

It is not possible to theme the bullets, your only option to customize them is to set the cli.condition_unicode_bullets option to FALSE:
r-lib/cli#411
r-lib/cli#396

@thothal
Copy link
Author

thothal commented Dec 6, 2024

Ok, then the docs of rlang::abort needs to be adapted.

@lionel-
Copy link
Member

lionel- commented Dec 9, 2024

hmm it does look like that it used to be possible to customise them: https://rlang.r-lib.org/reference/topic-condition-customisation.html#changing-the-bullet-symbols

Has something changed in that regard @gaborcsardi ?

@gaborcsardi
Copy link
Member

Probably the PR that I linked above.

@lionel- lionel- transferred this issue from r-lib/cli Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants