diff --git a/R/location.R b/R/location.R index ba90a3b5..6479a48f 100644 --- a/R/location.R +++ b/R/location.R @@ -78,20 +78,14 @@ ##' @param verify Logical, indicating if we should verify that the ##' location can be used before adding. ##' -##' @param quiet Logical, indicating if we should print information -##' while configuring and creating locations. If not given, we use -##' the option of `orderly.quiet`, defaulting to `TRUE`. -##' ##' @inheritParams orderly_metadata ##' ##' @return Nothing ##' @export -orderly_location_add <- function(name, type, args, verify = TRUE, quiet = NULL, - root = NULL) { +orderly_location_add <- function(name, type, args, verify = TRUE, root = NULL) { root <- root_open(root, require_orderly = FALSE) assert_scalar_character(name) assert_scalar_logical(verify) - quiet <- orderly_quiet(quiet) if (name %in% location_reserved_name) { cli::cli_abort("Cannot add a location with reserved name '{name}'") @@ -119,16 +113,12 @@ orderly_location_add <- function(name, type, args, verify = TRUE, quiet = NULL, loc <- new_location_entry(name, type, args, call = environment()) if (verify) { - if (!quiet) { - cli::cli_alert_info("Testing location") - } + cli_alert_info("Testing location") driver <- location_driver_create(type, args) if (!is.null(driver$authorise)) { driver$authorise() } - if (!quiet) { - cli::cli_alert_success("Location configured successfully") - } + cli_alert_success("Location configured successfully") } config <- root$config @@ -146,11 +136,9 @@ orderly_location_add <- function(name, type, args, verify = TRUE, quiet = NULL, ##' be unreliable. ##' ##' @export -orderly_location_add_path <- function(name, path, verify = TRUE, quiet = NULL, - root = NULL) { +orderly_location_add_path <- function(name, path, verify = TRUE, root = NULL) { args <- list(path = path) - orderly_location_add(name, "path", args, verify = verify, quiet = quiet, - root = root) + orderly_location_add(name, "path", args, verify = verify, root = root) } @@ -160,11 +148,9 @@ orderly_location_add_path <- function(name, path, verify = TRUE, quiet = NULL, ##' example `http://example.com:8080` ##' ##' @export -orderly_location_add_http <- function(name, url, verify = TRUE, quiet = NULL, - root = NULL) { +orderly_location_add_http <- function(name, url, verify = TRUE, root = NULL) { args <- list(url = url) - orderly_location_add(name, "http", args, verify = verify, quiet = quiet, - root = root) + orderly_location_add(name, "http", args, verify = verify, root = root) } @@ -182,11 +168,9 @@ orderly_location_add_http <- function(name, url, verify = TRUE, quiet = NULL, ##' @export orderly_location_add_packit <- function(name, url, token = NULL, save_token = NULL, - verify = TRUE, quiet = NULL, - root = NULL) { + verify = TRUE, root = NULL) { args <- list(url = url, token = token, save_token = save_token) - orderly_location_add(name, "packit", args, verify = verify, quiet = quiet, - root = root) + orderly_location_add(name, "packit", args, verify = verify, root = root) } diff --git a/R/location_packit.R b/R/location_packit.R index 0dad14d6..16f4dc7d 100644 --- a/R/location_packit.R +++ b/R/location_packit.R @@ -42,20 +42,17 @@ do_oauth_device_flow <- function(base_url, cache_disk) { # It also means the user cannot easily use two different identities on the same # server from within the same session. auth_cache <- new.env(parent = emptyenv()) -packit_authorisation <- function(base_url, token, save_token, quiet = NULL) { +packit_authorisation <- function(base_url, token, save_token) { # If a non-Github token is provided, we assume it is a native Packit token # and use that directly. if (!is.null(token) && !grepl("^gh._", token)) { return(list("Authorization" = paste("Bearer", token))) } - quiet <- orderly_quiet(quiet) key <- rlang::hash(list(base_url = base_url, token = token)) if (is.null(auth_cache[[key]])) { - if (!quiet) { - cli::cli_alert_info("Logging in to {base_url}") - } + cli_alert_info("Logging in to {base_url}") if (is.null(token)) { token <- do_oauth_device_flow(base_url, cache_disk = save_token) } @@ -65,9 +62,7 @@ packit_authorisation <- function(base_url, token, save_token, quiet = NULL) { login_url, function(r) http_body_json(r, list(token = scalar(token)))) - if (!quiet) { - cli::cli_alert_success("Logged in successfully") - } + cli_alert_success("Logged in successfully") auth_cache[[key]] <- list("Authorization" = paste("Bearer", res$token)) } @@ -94,5 +89,5 @@ orderly_location_packit <- function(url, token = NULL, save_token = TRUE) { orderly_location_http$new( paste0(url, "packit/api/outpack"), - function(quiet = NULL) packit_authorisation(url, token, save_token, quiet)) + function() packit_authorisation(url, token, save_token)) } diff --git a/man/orderly_location_add.Rd b/man/orderly_location_add.Rd index 8ac26862..609aa3f1 100644 --- a/man/orderly_location_add.Rd +++ b/man/orderly_location_add.Rd @@ -7,18 +7,11 @@ \alias{orderly_location_add_packit} \title{Add a new location} \usage{ -orderly_location_add( - name, - type, - args, - verify = TRUE, - quiet = NULL, - root = NULL -) +orderly_location_add(name, type, args, verify = TRUE, root = NULL) -orderly_location_add_path(name, path, verify = TRUE, quiet = NULL, root = NULL) +orderly_location_add_path(name, path, verify = TRUE, root = NULL) -orderly_location_add_http(name, url, verify = TRUE, quiet = NULL, root = NULL) +orderly_location_add_http(name, url, verify = TRUE, root = NULL) orderly_location_add_packit( name, @@ -26,7 +19,6 @@ orderly_location_add_packit( token = NULL, save_token = NULL, verify = TRUE, - quiet = NULL, root = NULL ) } @@ -45,10 +37,6 @@ will vary depending on the type used, see Details.} \item{verify}{Logical, indicating if we should verify that the location can be used before adding.} -\item{quiet}{Logical, indicating if we should print information -while configuring and creating locations. If not given, we use -the option of \code{orderly.quiet}, defaulting to \code{TRUE}.} - \item{root}{The path to the root directory, or \code{NULL} (the default) to search for one from the current working directory. This function does not require that the directory is