Open allefeld opened 1 month ago
I believe this is by designed from 0f5586d018d0a51ba4528e43c8d30f597a5be8a1 https://github.com/quarto-dev/quarto-cli/blob/2bc956a668ceba50ca47a3975f0ebf10b763ac13/src/command/use/commands/template.ts#L303-L317
We explicitly error when --no-prompt
and directory is not empty to prevent any accidental override that would be destructive. This is why we prompt user. Initially, it was only working in empty directory. Quarto allows non empty directory, but only after prompt validation.
Changing this would be a change in behavior to reverse completely our assumptions. This is a change that should be carefully consider. Is there a use case where this is completely blocking you ?
General rule for us is usually to have explicit user action (prompt or empty dir + copy elsewhere for example), and to avoid as much as possibly implicit that could be harmful.
I understand. Though in the case I tested, the process would not have been destructive: There were other files, but not the ones written by quarto use template
from this specific template.
Then I propose, as an enhancement, that the answers to the questions can be specified on the command line, e.g. by extending the syntax of --no-prompt
. Reason: I'd like to use this command in a script.
I have to admit that my intended use is a slight abuse: Not to initialise a project, but to add to it resusable files. It would be great if that would remain possible, including non-interactively, because there is no native way to download all files from a GitHub repository subdirectory.
Bug description
Interactively, it is possible to install a template into a directory which already contains files, even if one accepts the defaults:
With
--no-prompt
, under the same circumstances an error occurs:Steps to reproduce
Run
quarto use template --no-prompt
in a directory which contains files.Expected behavior
quarto use template --no-prompt
should behave the same as interactively with accepting the default options.Actual behavior
see above
Your environment
Debian 12.7
Quarto check output