quarto-dev / quarto-dev/quarto-r

`quarto_use_template` doesn't run if I'm not in an empty directory

Open
#230 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement upstream
Dominant language
R
Stars
161
Forks
29
Avg merge
3h 18m
Merged PRs (30d)
1

Description

Hi !

Some info on the code:

  • I have a template in inst/templates/memo
  • quarto_add_extension works well
  • I'm using the dev version
  • I don't have a template.qmd file at the root of mypackage

This isn't a reprex, let me know if that's needed

> create_memo <- function() {
+     template_path <- system.file("templates/memo", package = "wvc")
+     quarto::quarto_use_template(template_path, no_prompt = TRUE)
+ }
+ create_memo()
ERROR: Unable to install in /Users/josephbarbier/Desktop/wvc as the directory isn't empty.

Stack trace:
    at determineDirectory (file:///Applications/quarto/bin/quarto.js:117557:19)
    at useTemplate (file:///Applications/quarto/bin/quarto.js:117405:39)
    at async Command.actionHandler (file:///Applications/quarto/bin/quarto.js:117392:9)
    at async Command.execute (file:///Applications/quarto/bin/quarto.js:8111:13)
    at async Command.parseCommand (file:///Applications/quarto/bin/quarto.js:8001:20)
    at async quarto (file:///Applications/quarto/bin/quarto.js:126627:9)
    at async file:///Applications/quarto/bin/quarto.js:126654:9
    at async mainRunner (file:///Applications/quarto/bin/quarto.js:126519:9)
    at async file:///Applications/quarto/bin/quarto.js:126645:5

I'm sure I'm doing something wrong, but I don't know how I'm supposed to use the quarto_use_template function? A few points:

  • how do I run the function in a completely empty directory? Like, I need at least .R file anyway to run the code?
  • Is there any way around this and say ‘create it here instead’?

I really feel like I've missed something because my questions are a bit stupid

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the quarto_use_template entry point and reproduce the reported call with a non-empty directory. Compare its behavior with quarto_add_extension and the Quarto CLI error shown in the issue. Done means the supported usage or destination behavior is clarified and covered by an appropriate regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.