-
Notifications
You must be signed in to change notification settings - Fork 285
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
Migrate ui_*() functionality to use cli #956
Comments
Also related to #673 |
Does this mean that some |
@GegznaV given that we haven't done it yet and we're likely to leave the existing functions in some capacity, no. But I would recommend to switching to cli. |
@jennybc Is the plan to modify the implementation of the Currently ui_oops("
Found legacy {ui_field('Author')} and/or {ui_field('Maintainer')} field ")
ui_field <- function(x) {
x <- crayon::green(x)
x <- glue_collapse(x, sep = ", ")
x
}
ui_oops <- function(x, .envir = parent.frame()) {
x <- glue_collapse(x, "\n")
x <- glue(x, .envir = .envir)
ui_bullet(x, crayon::red(cli::symbol$cross))
} plan 1 : use cli directlycli::cli_alert_danger("Found {.field Author} and/or {.field Maintainer} field") plan 2: Modify
|
I was planning on doing this myself rather soon, as I too am growing increasingly sad about usethis not having the modern goodies cli provides. And my plan is to leave the One reason (I suspect there are others) to do it this way is that we still need to honor the |
Ok! makes sense. The only thing that may be problematic is that usethis relies heavily on glue for the changes of lines. In cli, it is always better to wrap each line on their own bullet. I think that something that may be more complex would be the indentation or line breaks the are handled differently in glue vs cli. ui_stop("
Unable to discover a GitHub personal access token
A token is required in order to fork {ui_value('repo_spec')}
Call {ui_code('hint')} for help configuring a token")
#> Error: Unable to discover a GitHub personal access token
#> A token is required in order to fork 'repo_spec'
#>
#> Call `hint` for help configuring a token Created on 2023-12-05 with reprex v2.0.2
cli::cli_abort("
Unable to discover a GitHub personal access token
A token is required in order to fork {usethis::ui_value('repo_spec')}
Call {usethis::ui_code('hint')} for help configuring a token")
#> Error:
#> ! Unable to discover a GitHub personal access
#> token A token is required in order to fork
#> 'repo_spec'
#>
#> Call `hint` for help configuring a token ideas
|
See notes here: r-lib/cli#68
and the transition guide: https://cli.r-lib.org/dev/articles/usethis-ui.html
The text was updated successfully, but these errors were encountered: