Skip to content

Commit 849c9bd

Browse files
committed
show serve url in cli inform message
1 parent c4657dd commit 849c9bd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

R/daemon.R

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ run_serve_daemon <- function(
6262

6363
# port and host
6464
args <- c(args, "--port", port)
65-
if (!identical(host, "127.0.0.1")) {
65+
if (identical(host, "127.0.0.1")) {
66+
host <- "localhost" # use localhost for consistency
67+
}
68+
if (!identical(host, "localhost")) {
6669
args <- c(args, "--host", host)
6770
}
6871

@@ -148,12 +151,14 @@ run_serve_daemon <- function(
148151
}
149152
poll_process()
150153

154+
serve_url <- quarto[[url_key]] %||% sprintf("http://%s:%i", host, port)
155+
151156
# indicate server is running
152157
if (isFALSE(quiet)) {
153-
cli::cli
154158
cli::cli_inform(c(
155159
"",
156-
i = "Stop the preview with {.code quarto_{command}_stop()}"
160+
"i" = "Preview server running at {.url {serve_url}}",
161+
">" = "Stop the preview with {.code quarto_{command}_stop()}"
157162
))
158163
}
159164

@@ -166,11 +171,10 @@ run_serve_daemon <- function(
166171
utils::browseURL
167172
)
168173
}
169-
serve_url <- quarto[[url_key]] %||% paste0("http://localhost:", port)
170174
browse(serve_url)
171175
}
172176

173-
invisible()
177+
invisible(serve_url)
174178
}
175179

176180
stop_serve_daemon <- function(command) {

0 commit comments

Comments
 (0)