R/setPackageOptions.R

Defines functions sag_messages sag_use_token

Documented in sag_messages sag_use_token

#' Get and Set icesSAG package options
#'
#' There are two options of interest, 1) switch on or off the use off
#' authenticated web service calls, and 2) switch on or off the display of
#' messages to the console.
#'
#' @param value TRUE or FALSE
#'
#' @return invisible return of the old value.
#'
#' @examples
#' \dontrun{
#' sag_use_token(TRUE)
#' sag_messages(TRUE)
#' }
#'
#' @rdname setPackageOptions
#' @name setPackageOptions
NULL

#' @rdname setPackageOptions
#' @export
sag_use_token <- function(value) {
  old_value <- getOption("icesSAG.use_token")
  options(icesSAG.use_token = identical(value, TRUE))

  invisible(old_value)
}

#' @rdname setPackageOptions
#' @export
sag_messages <- function(value) {
  old_value <- getOption("icesSAG.messages")
  options(icesSAG.messages = identical(value, TRUE))

  invisible(old_value)
}

Try the icesSAG package in your browser

Any scripts or data that you put into this service are public.

icesSAG documentation built on Oct. 30, 2024, 9:14 a.m.