-
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
Is it possible to use suppressPackageStartupMessages on cli message? #589
Comments
I looked at the approach tidyverse uses and pieced something together with greet_startup <- function() {
msg <- paste0(
c(
"Hi, this is {.emph askgpt} {cli::symbol$smiley}.",
"{cli::symbol$bullet} To start error logging, run {.run [{.fun log_init}](askgpt::log_init())} now.",
"{cli::symbol$bullet} To see what you can do use {.help [{.fun ?askgpt}](askgpt::askgpt)}.",
"{cli::symbol$bullet} Or just run {.run [{.fun askgpt}](askgpt::askgpt())} with any question you want!"
),
collapse = "\n"
)
rlang::inform(cli::format_inline(msg), class = "packageStartupMessage")
}
greet_startup()
#> Hi, this is askgpt ☺.
#> • To start error logging, run `` `log_init()` `` now.
#> • To see what you can do use `?askgpt()` (`?askgpt::askgpt()`).
#> • Or just run `` `askgpt()` `` with any question you want!
suppressPackageStartupMessages(greet_startup()) Created on 2023-03-14 with reprex v2.0.2 It would be cool to get a way of doing this just in cli, but I assume you already have this in mind, so I'm closing the issue. |
There is no good way, currently, but it is easy to add an option for this. |
So... it looks like someone fixed this? At least, if you use
Seems to work! |
Is there a way to write a suppressible startup message with
cli
? I'm writing a package for beginners of R and wanted to give some hints, but startup messages need to be suppressible to conform with CRAN guidelines. I had assumed something like this would work:Created on 2023-03-13 with reprex v2.0.2
Or maybe this:
Created on 2023-03-13 with reprex v2.0.2
Am I missing something obvious?
The text was updated successfully, but these errors were encountered: