From 3d25c1fcf0d061f8d2456e21e2a90858fa201fa5 Mon Sep 17 00:00:00 2001 From: Felix Henninger Date: Mon, 11 Sep 2023 20:47:48 +0200 Subject: [PATCH] Add RStudio UI for new project from template --- R/template_project.r | 12 ++++++++++++ inst/rstudio/templates/project/file.dcf | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 R/template_project.r create mode 100644 inst/rstudio/templates/project/file.dcf diff --git a/R/template_project.r b/R/template_project.r new file mode 100644 index 0000000..7c0416a --- /dev/null +++ b/R/template_project.r @@ -0,0 +1,12 @@ +template_project <- function(path, ...) { + # Collect further arguments + dots <- list(...) + + # Pass on to bake function + bake( + dots$template, + path, + no_input=dots$no_input, + overwrite=dots$overwrite + ) +} diff --git a/inst/rstudio/templates/project/file.dcf b/inst/rstudio/templates/project/file.dcf new file mode 100644 index 0000000..d4d784a --- /dev/null +++ b/inst/rstudio/templates/project/file.dcf @@ -0,0 +1,17 @@ +Title: Cookiecutter template +Caption: Create a new project from a template +Binding: template_project + +Parameter: template +Widget: FileInput +Label: Template + +Parameter: no_input +Widget: CheckboxInput +Label: Skip asking for template parameters +Default: Off + +Parameter: overwrite +Widget: CheckboxInput +Label: Overwrite existing files +Default: Off