Skip to content

Commit 4066f0e

Browse files
author
‘topepo’
committed
Merge remote-tracking branch 'upstream/main'
2 parents 0f2942d + d71b135 commit 4066f0e

File tree

11 files changed

+44
-37
lines changed

11 files changed

+44
-37
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: quarto
22
Title: R Interface to 'Quarto' Markdown Publishing System
3-
Version: 1.4.1
3+
Version: 1.4.2
44
Authors@R: c(
55
person("JJ", "Allaire", , "[email protected]", role = "aut",
66
comment = c(ORCID = "0000-0003-0174-9868")),

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
- Added a `new_blog_post()` function (#22).
44

5+
- Approval check in `quarto_add_extension()` and `quarto_use_template()` now works correctly (thanks, @eveyp, #172).
6+
57
# quarto 1.4
68

79
- This version is now adapted to Quarto 1.4 latest stable release.

R/add.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ quarto_add_extension <- function(extension = NULL, no_prompt = FALSE, quiet = FA
3737
quarto_bin <- find_quarto()
3838

3939
# This will ask for approval or stop installation
40-
check_extension_approval(no_prompt, "Quarto extensions", "https://quarto.org/docs/extensions/managing.html")
40+
approval <- check_extension_approval(no_prompt, "Quarto extensions", "https://quarto.org/docs/extensions/managing.html")
4141

42-
args <- c(extension, "--no-prompt", if (quiet) cli_arg_quiet(), quarto_args)
43-
44-
quarto_add(args, quarto_bin = quarto_bin, echo = TRUE)
42+
if (approval) {
43+
args <- c(extension, "--no-prompt", if (quiet) cli_arg_quiet(), quarto_args)
44+
quarto_add(args, quarto_bin = quarto_bin, echo = TRUE)
45+
}
4546

4647
invisible()
4748
}

R/render.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#' @param quarto_args Character vector of other `quarto` CLI arguments to append
4545
#' to the Quarto command executed by this function. This is mainly intended for
4646
#' advanced usage and useful for CLI arguments which are not yet mirrored in a
47-
#' dedicated parameter of this \R function.
47+
#' dedicated parameter of this \R function. See `quarto render --help` for options.
4848
#' @param pandoc_args Additional command line arguments to pass on to Pandoc.
4949
#' @param as_job Render as an RStudio background job. Default is "auto",
5050
#' which will render individual documents normally and projects as

R/use.R

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,21 @@ quarto_use_template <- function(template, no_prompt = FALSE, quiet = FALSE, quar
2828
quarto_bin <- find_quarto()
2929

3030
# This will ask for approval or stop installation
31-
check_extension_approval(no_prompt, "Quarto templates", "https://quarto.org/docs/extensions/formats.html#distributing-formats")
31+
approval <- check_extension_approval(no_prompt, "Quarto templates", "https://quarto.org/docs/extensions/formats.html#distributing-formats")
3232

33-
# quarto use template does not support `--quiet` so we mimic it by suppressing `echo` in processx
34-
# TODO: Change if / when https://github.com/quarto-dev/quarto-cli/issues/8438
35-
args <- c("template", template, "--no-prompt", quarto_args)
33+
if (approval) {
3634

37-
if (quarto_version() > "1.5.4" & isTRUE(quiet)) {
38-
args <- cli_arg_quiet(args)
39-
}
35+
# quarto use template does not support `--quiet` so we mimic it by suppressing `echo` in processx
36+
# TODO: Change if / when https://github.com/quarto-dev/quarto-cli/issues/8438
37+
args <- c("template", template, "--no-prompt", quarto_args)
38+
39+
if (quarto_version() > "1.5.4" & isTRUE(quiet)) {
40+
args <- cli_arg_quiet(args)
41+
}
4042

41-
quarto_use(args, quarto_bin = quarto_bin, echo = !quiet)
43+
quarto_use(args, quarto_bin = quarto_bin, echo = !quiet)
44+
45+
}
4246

4347
invisible()
4448
}

R/utils-prompt.R

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
check_extension_approval <- function(no_prompt = FALSE, what = "Something", see_more_at = NULL) {
2-
if (!no_prompt) {
3-
if (!rlang::is_interactive()) {
4-
cli::cli_abort(c(
5-
"{ what } requires explicit approval.",
6-
">" = "Set {.arg no_prompt = TRUE} if you agree.",
7-
if (!is.null(see_more_at)) {
8-
c(i = "See more at {.url {see_more_at}}")
9-
}
10-
))
11-
} else {
12-
cli::cli_inform(c(
13-
"{what} may execute code when documents are rendered. ",
14-
"*" = "If you do not trust the author(s) of this {what}, we recommend that you do not install or use this {what}."
15-
))
16-
prompt_value <- tolower(readline(sprintf("Do you trust the authors of this %s (Y/n)? ", what)))
17-
if (!prompt_value %in% "y") {
18-
cli::cli_inform("{what} not installed.")
19-
return(invisible(FALSE))
2+
if (no_prompt) return(TRUE)
3+
4+
if (!rlang::is_interactive()) {
5+
cli::cli_abort(c(
6+
"{ what } requires explicit approval.",
7+
">" = "Set {.arg no_prompt = TRUE} if you agree.",
8+
if (!is.null(see_more_at)) {
9+
c(i = "See more at {.url {see_more_at}}")
2010
}
11+
))
12+
} else {
13+
cli::cli_inform(c(
14+
"{what} may execute code when documents are rendered. ",
15+
"*" = "If you do not trust the author(s) of this {what}, we recommend that you do not install or use this {what}."
16+
))
17+
prompt_value <- tolower(readline(sprintf("Do you trust the authors of this %s (Y/n)? ", what)))
18+
if (!prompt_value %in% "y") {
19+
cli::cli_inform("{what} not installed.")
20+
return(invisible(FALSE))
2121
}
2222
}
2323
}

man/quarto_add_extension.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/quarto_create_project.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/quarto_inspect.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/quarto_render.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)