Skip to content

Commit 2043559

Browse files
committed
feat: add shiny module tag in template
1 parent 9dc5465 commit 2043559

File tree

1 file changed

+23
-25
lines changed

1 file changed

+23
-25
lines changed

R/modules_fn.R

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,19 @@
2626
#'
2727
#' @return The path to the file, invisibly.
2828
add_module <- function(
29-
name,
30-
pkg = get_golem_wd(),
31-
open = TRUE,
32-
dir_create = TRUE,
33-
fct = NULL,
34-
utils = NULL,
35-
r6 = NULL,
36-
js = NULL,
37-
js_handler = NULL,
38-
export = FALSE,
39-
module_template = golem::module_template,
40-
with_test = FALSE,
41-
...
42-
) {
29+
name,
30+
pkg = get_golem_wd(),
31+
open = TRUE,
32+
dir_create = TRUE,
33+
fct = NULL,
34+
utils = NULL,
35+
r6 = NULL,
36+
js = NULL,
37+
js_handler = NULL,
38+
export = FALSE,
39+
module_template = golem::module_template,
40+
with_test = FALSE,
41+
...) {
4342
# Let's start with the checks for the validity of the name
4443
check_name_length_is_one(name)
4544
check_name_syntax(name)
@@ -187,13 +186,12 @@ add_module <- function(
187186
#' @export
188187
#' @seealso [add_module()]
189188
module_template <- function(
190-
name,
191-
path,
192-
export,
193-
ph_ui = " ",
194-
ph_server = " ",
195-
...
196-
) {
189+
name,
190+
path,
191+
export,
192+
ph_ui = " ",
193+
ph_server = " ",
194+
...) {
197195
write_there <- function(...) {
198196
write(..., file = path, append = TRUE)
199197
}
@@ -204,6 +202,7 @@ module_template <- function(
204202
write_there("#'")
205203
write_there("#' @param id,input,output,session Internal parameters for {shiny}.")
206204
write_there("#'")
205+
write_there("#' @shinyModule A Golem module.")
207206
if (export) {
208207
write_there(sprintf("#' @rdname mod_%s", name))
209208
write_there("#' @export ")
@@ -274,10 +273,9 @@ module_template <- function(
274273
#' @return Used for side effect. Returns the path invisibly.
275274
#' @export
276275
use_module_test <- function(
277-
name,
278-
pkg = get_golem_wd(),
279-
open = TRUE
280-
) {
276+
name,
277+
pkg = get_golem_wd(),
278+
open = TRUE) {
281279
# Remove the extension if any
282280
name <- file_path_sans_ext(name)
283281
# Remove the "mod_" if any

0 commit comments

Comments
 (0)