-
Notifications
You must be signed in to change notification settings - Fork 70
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
cl_dl output is missing if string contains #
or '
#370
Comments
#
or '
it looks like cli::cli_dl(c("test_3" = "no' good either"))
#> test_3: cli::cli_dl(c("test_4" = "no\" good also"))
#> test_4: |
This was an issue with {glue}: tidyverse/glue#193 and was fixed in the latest release, but now brings up a new problem: cli::cli_text("{.url https://example.com/#section}")
#> Error in glue_data(.x = NULL, ..., .sep = .sep, .envir = .envir, .open = .open, : Unterminated comment Created on 2021-11-10 by the reprex package (v2.0.1) |
This behavior is fixed if you put the strings as variables, however: url <- "https://example.com/#section"
cli::cli_text("{.url {url}}")
#> <https://example.com/#section> msg <- "no' good either"
cli::cli_dl(c("test_3" = "{msg}"))
#> test_3: no' good either Created on 2021-11-10 by the reprex package (v2.0.1) This is explicitly tested in cli/tests/testthat/test-inline.R Lines 50 to 56 in 1af3d91
|
I think probably cli should set |
It would certainly help when providing a Klingon translation to messages (in a romanized script): cli::cli_alert_success("Qapla'") |
This was fixed by 64a389e, but I messed up the issue number reference.... |
Unfortunately I'll have to re-open this temporarily because it breaks some revdeps, and there is no way to escape braces with |
Opened in 5ee4974 |
For the record, AFAICT the problematic cli functions are ❯ cli_dl(c(x = "foobar'"))
Error in glue_data(.x = NULL, ..., .sep = .sep, .envir = .envir, .open = .open, :
Unterminated quote (')
❯ cli_process_start("foobar'")
Error in glue_data(.x = NULL, ..., .sep = .sep, .envir = .envir, .open = .open, :
Unterminated quote (')
❯ cli_progress_step("foobar'")
Error in glue_data(.x = NULL, ..., .sep = .sep, .envir = .envir, .open = .open, :
Unterminated quote (') |
I have just been re-reminded of this issue. Currently googledrive's basic messaging about files won't work if the name contains, e.g., a single quote. Which is a fairly common phenomenon. The way I call x <- c(
"Drive file:",
"*" = "{.file boring_file_name} {cli::col_grey('<id: 1_CqHhC>')}"
)
cli::cli_bullets(x)
#> Drive file:
#> • 'boring_file_name' <id: 1_CqHhC>
x <- c(
"Drive file:",
"*" = "{.file I'm a challenging file name} {cli::col_grey('<id: 1_CqHhC>')}"
)
cli::cli_bullets(x)
#> Error in glue_data(.x = NULL, ..., .sep = .sep, .envir = .envir, .open = .open, : Unterminated quote (') (In real life, I have written a custom inline style for Google Drive file names, instead of I'm not even quite sure where I could insert |
The pattern that works is fn <- "I'm a challenging file name"
x <- c(
"Drive file:",
"*" = "{.file {fn}} {cli::col_grey('<id: 1_CqHhC>')}"
)
cli::cli_bullets(x) |
In general, to fix this cli needs its own parser, because the current cli extensions cannot be parsed properly with multiple rounds of glue with some combination of |
- Désactivation des cli_progress_step, qui causent TOUS une erreur chez moi. Le pb est connu : r-lib/cli#370
Created on 2021-11-02 by the reprex package (v2.0.1)
The text was updated successfully, but these errors were encountered: