-
Notifications
You must be signed in to change notification settings - Fork 302
Closed
Labels
featurea feature request or enhancementa feature request or enhancementtooling 🔨Internal usethis toolingInternal usethis tooling
Description
I'm developing a package that wants to prompt the user to add some code to their .R profile (in this case, a .Last function.)
I love how use_usethis() locates and opens the .Rprofile via edit_r_profile while also displaying the code to be added and writing it to the clipboard. However, the function code_block() for formatting and accessing the clipboard is not exported currently. Are there plans to export code_block() in the future so we can create generic use_usethis-esque functions? Or perhaps create some kind of API for creating generic use_ functions, maybe by way of a closure/function factory?
use_ <- function(edit_function, todo_text, code, ...) {
function() {
edit_function(...)
todo(todo_text)
code_block(code)
}
}
use_x <- use_(edit_r_profile,
todo_text = "Include this code in your .Rprofile to get x package working",
code = c(".Last <- function() {", "message('All done.')", "}")(Unless there is some way to call use_template() for this that I've missed?)
lwjohnst86
Metadata
Metadata
Assignees
Labels
featurea feature request or enhancementa feature request or enhancementtooling 🔨Internal usethis toolingInternal usethis tooling