|
4 | 4 | #' config and engines. Inspecting an input path return its formats, engine, |
5 | 5 | #' and dependent resources. |
6 | 6 | #' |
| 7 | +#' @inheritParams quarto_render |
7 | 8 | #' @param input The input file or project directory to inspect. |
8 | 9 | #' |
9 | | -#' @return Named list. For input files, the list has members engine, format, |
10 | | -#' and resources. For projects the list has members engines and config |
11 | | -#' |
12 | | -#' @importFrom jsonlite fromJSON |
| 10 | +#' @return Named list. For input files, the list contains the elements |
| 11 | +#' `quarto`, `engines`, `formats`, `resources`, plus `project` if the file is |
| 12 | +#' part of a Quarto project. For projects, the list contains the elements |
| 13 | +#' `quarto`, `dir`, `engines`, `config` and `files`. |
13 | 14 | #' |
14 | 15 | #' @examples |
15 | 16 | #' \dontrun{ |
|
18 | 19 | #' |
19 | 20 | #' # Inspect project |
20 | 21 | #' quarto_inspect("myproject") |
21 | | -#' } |
22 | 22 | #' |
| 23 | +#' # Inspect project's advanced profile |
| 24 | +#' quarto_inspect( |
| 25 | +#' input = "myproject", |
| 26 | +#' profile = "advanced" |
| 27 | +#' )} |
| 28 | +#' @importFrom jsonlite fromJSON |
23 | 29 | #' @export |
24 | | -quarto_inspect <- function(input = ".") { |
| 30 | +quarto_inspect <- function(input = ".", |
| 31 | + profile = NULL) { |
25 | 32 |
|
26 | 33 | quarto_bin <- find_quarto() |
27 | 34 |
|
28 | | - output <- system2(quarto_bin, stdout = TRUE, c( |
29 | | - "inspect", |
30 | | - path.expand(input) |
31 | | - )) |
| 35 | + args <- c("inspect", path.expand(input)) |
32 | 36 |
|
33 | | - fromJSON(output) |
34 | | -} |
| 37 | + if (!is.null(profile)) { |
| 38 | + args <- c(args, c("--profile", paste0(profile, collapse = ","))) |
| 39 | + } |
| 40 | + |
| 41 | + res <- processx::run(quarto_bin, args, echo_cmd = getOption("quarto.echo_cmd", FALSE)) |
35 | 42 |
|
| 43 | + fromJSON(res$stdout) |
| 44 | +} |
0 commit comments