R/cli.R

Defines functions benchy

Documented in benchy

#' Run benchmark
#'
#' @description
#' Function runs benchmark after processing user's command.
#' By default function saves benchmark output to RDS file.
#' @export

benchy = function() {
  command = 
    parse_command() %T>%
    process_command()

  cli::cli_h1("Loading benchmark config")

  config_options =
    yaml::read_yaml(command$options$config) %T>%
    show_config()

  cli::cli_h1("Loading algorithms")

  source_dir()
  config_options$methods %>%
    find_methods()

  cli::cli_h1("Starting benchmark")
  cli::cli_alert_warning("Are you sure about running benchmark with given config? y/n")

  choice = readLines(file("stdin"), n = 1)

  if(choice == "y") {
    config_options$methods %>%
      purrr::map(function(method) {
        cli::cli_h2("{method} is running... (it may take a while, ba patient!)")
        Sys.sleep(5)
        1
        
         })
  }
  else
    cli::cli_alert_danger("Benchmark aborted.")
}
warbarbye/cecs-benchmark documentation built on March 10, 2020, 12:09 a.m.