Handling of interactive No to `clean_doc` question
The meaning of a No response to the interactive prompt is unclear, even after selecting it. Furthermore, the ensuing behavior is surprising and unhelpful.
Sample
This is from a vanilla R session (not RStudio):
> devtools::build()
Running bootstrap.R...
# ...
Building the package will delete...
'C:/Users/rdboylan/Documents/BP/pimex/inst/doc'
Are you sure?
1: Yes
2: No
Selection: 2
-- R CMD ---------------------------------------------------------------------------------------
no("wd") || is_string(wd) is not TRUE
eval(substitute(expr), data, enclos = parent.frame())
TRUE
NULL
NULL
30180
1716004002
0
Problems
-
Are you sure?probably means "do you want to delete inst/doc?", but it could mean "do you want to continue with the build?" It's ambiguous. For the pedantic, there is a 3rd interpretation: "say whether or not you are sure that this tool deletes the directory". - The material following
Selection: 2has no obvious meaning or significance. In particular, it doesn't resolve the question of whether the deletion or the whole build was aborted. - It seems that selecting 2, aka
Noactually did abort the build, since no tarball resulted. It would be more helpful if it left the directory in place and continued with the build.
Desired Behavior
- Selecting
Noleavesinst/docand proceeds with the build. - Selecting
Nodoes not produce the meaningless output shown above. - The question clearly indicates what behavior will result from a
YesorNoresponse, and that matches what happens.
"leaves inst/doc" above simply means the deletion of the directory is skipped; it is not intended to mean no new material such as vignettes will be placed in inst/doc.
Code
https://github.com/r-lib/pkgbuild/blob/90f017b337ae23006b10fd8a5db1040ddf5fd401/R/build.R#L251C1-L256C10 seems to be the relevant code. If option 2 is selected then return() is executed. My expectation, and I think the intention, is that it simply exits from the block beginning at https://github.com/r-lib/pkgbuild/blob/90f017b337ae23006b10fd8a5db1040ddf5fd401/R/build.R#L248 and proceeds. But the remaining steps are in body of the same function and the return simply skips them.
Context
R 4.4.0 pkgbuild 1.4.4 devtools 2.4.5 MS Windows amd64