Skip to content

Commit db8f726

Browse files
committed
usethis::use_tidy_style()
1 parent ab875ea commit db8f726

19 files changed

+127
-127
lines changed

R/add.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ quarto_add_extension <- function(extension = NULL, no_prompt = FALSE, quiet = FA
3939
# This will ask for approval or stop installation
4040
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)
42+
args <- c(extension, "--no-prompt", if (quiet) cli_arg_quiet(), quarto_args)
4343

4444
quarto_add(args, quarto_bin = quarto_bin, echo = TRUE)
4545

R/backports.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
if (getRversion() < "3.5.0") {
32
isFALSE <- function(x) identical(x, FALSE)
43
}

R/create.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#'
2222
#' @export
2323
quarto_create_project <- function(name, type = "default", dir = ".", no_prompt = FALSE, quiet = FALSE, quarto_args = NULL) {
24-
2524
check_quarto_version("1.4", "quarto create project", "https://quarto.org/docs/projects/quarto-projects.html")
2625

2726
if (rlang::is_missing(name)) {
@@ -45,7 +44,6 @@ quarto_create_project <- function(name, type = "default", dir = ".", no_prompt =
4544
owd <- setwd(dir)
4645
on.exit(setwd(owd), add = TRUE, after = FALSE)
4746
quarto_create(args, quarto_bin = quarto_bin, echo = TRUE)
48-
4947
}
5048

5149
quarto_create <- function(args = character(), ...) {

R/daemon.R

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
21
run_serve_daemon <- function(command, target, wd, extra_args, render, port, host, browse) {
3-
42
# resolve target if provided
53
if (!is.null(target)) {
64
target <- path.expand(target)
@@ -78,7 +76,7 @@ run_serve_daemon <- function(command, target, wd, extra_args, render, port, host
7876

7977
# wait for port to be bound to
8078
init <- ""
81-
while(!port_active(port)) {
79+
while (!port_active(port)) {
8280
quarto[[ps_key]]$poll_io(50)
8381
cat(quarto[[ps_key]]$read_output())
8482
if (!quarto[[ps_key]]$is_alive()) {
@@ -114,8 +112,9 @@ run_serve_daemon <- function(command, target, wd, extra_args, render, port, host
114112
if (!isFALSE(browse)) {
115113
if (!is.function(browse)) {
116114
browse <- ifelse(rstudioapi::isAvailable(),
117-
rstudioapi::viewer,
118-
utils::browseURL)
115+
rstudioapi::viewer,
116+
utils::browseURL
117+
)
119118
}
120119
serve_url <- paste0("http://localhost:", port)
121120
browse(serve_url)
@@ -144,10 +143,11 @@ stop_serve_daemon <- function(command) {
144143
find_port <- function(port) {
145144
for (i in 1:20) {
146145
# determine the port (exclude those considered unsafe by Chrome)
147-
while(TRUE) {
146+
while (TRUE) {
148147
port <- 3000 + sample(5000, 1)
149-
if (!port %in% c(3659, 4045, 6000, 6665:6669,6697))
148+
if (!port %in% c(3659, 4045, 6000, 6665:6669, 6697)) {
150149
break
150+
}
151151
}
152152
# see if it's active
153153
if (!port_active(port)) {
@@ -158,10 +158,12 @@ find_port <- function(port) {
158158
}
159159

160160
port_active <- function(port) {
161-
tryCatch({
162-
suppressWarnings(con <- socketConnection("127.0.0.1", port, timeout = 1))
163-
close(con)
164-
TRUE
165-
}, error = function(e) FALSE)
161+
tryCatch(
162+
{
163+
suppressWarnings(con <- socketConnection("127.0.0.1", port, timeout = 1))
164+
close(con)
165+
TRUE
166+
},
167+
error = function(e) FALSE
168+
)
166169
}
167-

R/inspect.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
#' quarto_inspect(
2626
#' input = "myproject",
2727
#' profile = "advanced"
28-
#' )}
28+
#' )
29+
#' }
2930
#' @importFrom jsonlite fromJSON
3031
#' @export
3132
quarto_inspect <- function(input = ".",
3233
profile = NULL,
3334
quiet = FALSE,
3435
quarto_args = NULL) {
35-
3636
quarto_bin <- find_quarto()
3737

3838
args <- c("inspect", path.expand(input))

R/preview.R

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ quarto_preview <- function(file = NULL,
5252
browse = TRUE,
5353
watch = TRUE,
5454
navigate = TRUE) {
55-
5655
# default for file
5756
if (is.null(file)) {
58-
file = getwd()
57+
file <- getwd()
5958
}
6059

6160
# handle extra_args
@@ -68,19 +67,20 @@ quarto_preview <- function(file = NULL,
6867
}
6968

7069
# serve
71-
run_serve_daemon("preview",
72-
file,
73-
NULL,
74-
args,
75-
render,
76-
port,
77-
host,
78-
browse)
70+
run_serve_daemon(
71+
"preview",
72+
file,
73+
NULL,
74+
args,
75+
render,
76+
port,
77+
host,
78+
browse
79+
)
7980
}
8081

8182
#' @rdname quarto_preview
8283
#' @export
8384
quarto_preview_stop <- function() {
8485
stop_serve_daemon("preview")
8586
}
86-

0 commit comments

Comments
 (0)