diff --git a/NAMESPACE b/NAMESPACE index 23f8ac0..6722d49 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,6 +1,7 @@ # Generated by roxygen2: do not edit by hand export(configure) +export(drop_configs) export(extract_subsample_info) export(fetch_association_state) export(fetch_biomarker_params) @@ -24,6 +25,7 @@ export(find_runs) export(flog.logger) export(format_quantiles_as_widths) export(list_biomarker_names) +export(list_configs) export(list_datasets) export(list_models) export(list_parameter_names) diff --git a/R/geco_api.R b/R/geco_api.R index 2b6f474..4abb1db 100644 --- a/R/geco_api.R +++ b/R/geco_api.R @@ -145,31 +145,39 @@ configure <- function(user, password, host) { } } -#' List saved credentials +#' List saved configurations #' @param host Host identifier, defaults to 'geco' #' @export -list_credentials <- function(host='geco') { +list_configs <- function(host='geco') { service <- .get_keyring_service(host) key_list(service) } -#' Drop saved credentials -#' Warning! this will remove all saved credentials from the host. +#' Drop saved configurations +#' Warning! this will remove all saved configurations from the host. #' @param host Host identifier, defaults to 'geco' +#' @param user Optional username, provided as a string. +#' @seealso [list_configs()] #' @export -drop_credentials <- function(user, host='geco') { +drop_configs <- function(user, host='geco') { service <- .get_keyring_service(host) keys <- key_list(service) if (!missing(user)) { keys <- keys %>% filter(username == !!user) } - cli::cli_alert_warning('This will drop _ALL_ saved credentials listed.') - keys - if (askYesNo("Do you want to drop these credentials from your keyring?")) { - keys %>% - pull(username) %>% - walk(~ key_delete(service=service, username = .)) + if (nrow(keys) == 0) { + cli::cli_alert_info('No keys found.') + } else { + cli::cli_alert_warning('This will drop _ALL_ saved configs listed.') + print(keys) + confirm <- askYesNo("Do you want to drop these configs from your keyring?", + default = FALSE) + if (!is.na(confirm) && isTRUE(confirm)) { + keys %>% + pull(username) %>% + walk(~ key_delete(service=service, username = .)) + } } } diff --git a/man/drop_configs.Rd b/man/drop_configs.Rd new file mode 100644 index 0000000..885e54e --- /dev/null +++ b/man/drop_configs.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geco_api.R +\name{drop_configs} +\alias{drop_configs} +\title{Drop saved configurations +Warning! this will remove all saved configurations from the host.} +\usage{ +drop_configs(user, host = "geco") +} +\arguments{ +\item{user}{Optional username, provided as a string.} + +\item{host}{Host identifier, defaults to 'geco'} +} +\description{ +Drop saved configurations +Warning! this will remove all saved configurations from the host. +} +\seealso{ +[list_configs()] +} diff --git a/man/list_configs.Rd b/man/list_configs.Rd new file mode 100644 index 0000000..ff74ea7 --- /dev/null +++ b/man/list_configs.Rd @@ -0,0 +1,14 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/geco_api.R +\name{list_configs} +\alias{list_configs} +\title{List saved configurations} +\usage{ +list_configs(host = "geco") +} +\arguments{ +\item{host}{Host identifier, defaults to 'geco'} +} +\description{ +List saved configurations +}