R/mc_rb.R

Defines functions mc_rb

Documented in mc_rb

#' Remove an S3 bucket using mc command
#'
#' @param bucket Character string specifying the name of the bucket to remove
#' @param force Delete bucket without confirmation in non-interactive mode
#' @inherit mc return
#'
#' @examplesIf interactive()
#' 
#' # Create a new bucket named "my-bucket" on the "play" system
#' mc_mb("play/my-bucket")
#' mc_rb("play/my-bucket")
#'
#' @export
mc_rb <- function(bucket, force = FALSE) {
  if(interactive()){
    proceed <- utils::askYesNo("Are you sure?")
  } else {
    proceed <- force
    if(!proceed) {
      message("Run `mc_rb()` interactively or with force=TRUE")
      return(invisible(NULL))
    }
  }
  
  mc(paste("rb --force", bucket))
}

Try the minioclient package in your browser

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

minioclient documentation built on Nov. 7, 2023, 5:07 p.m.