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
Allow user to decline to overwrite existing file, from use_template() #348
Comments
I agree it makes sense to be able to opt-out of overwrite and not throw an error. However, my mind is very much elsewhere right now. Before making a PR, will you give a few bullet points re: what you plan to do so @hadley can also give a quick The objective is to make sure the change really needs to happen in usethis vs. in your package (without forcing you to do some awkward |
Definitely where I am at right now Ok here is a shot at what I would try:
|
I don't see why this needs to |
…tead of an error. Closes r-lib#348
…e an existing file and instead produces a message (#350) * a negative user response to overwriting a file produces a message instead of an error. Closes #348 * only modify if open = TRUE and the file is actually created * modify test_that names to reflect warnings * use longer form comparison * skip R 3.1 when testing message for use_readme overwrite * Tweak docs Also a test to see if I can push to boshek/master * Swap an if-else * These functions have moved * Use `done()` instead of `message()` * Add expectations for file or dir in the project * Finish adjusting to new behaviour or write_over() and use_template()
Currently
use_template
throws an error when one chooses not to overwrite an existing file:Is there any appetite for a PR that would add a
allow_existing
argument (or whatever the name) touse_template
? So that is, if a file already exists and theallow_existing
argument is set toTRUE
, and a user selects to not overwrite (at the prompt),use_template
simply outputs a 'CONTRIBUTING.md' already exists' warning rather than an error?The context is that we have a series of templates (CoC, README, etc) where a user, when setting up a project or package, may accept the template for some and keep existing files for others. Since
use_template
viawrite_over
throws an error, this type of process where sequential asking which files need to be overwritten is currently not possible.The text was updated successfully, but these errors were encountered: