R/get_gcae_version.R

Defines functions get_gcae_version

Documented in get_gcae_version

#' Get the version of GCAE
#' @inheritParams default_params_doc
#' @return the version of GCAE
#' @author Richèl J.C. Bilderbeek
#' @export
get_gcae_version <- function(
  gcae_options = create_gcae_options()
) {
  gcaer::check_gcae_options(gcae_options)
  gcaer::check_gcae_is_installed(gcae_options)
  text <- gcaer::get_gcae_help_text(gcae_options)
  version_line <- stringr::str_subset(
    string = text,
    pattern = "GCAE.*(v[:digit:]+\\.[:digit:]+)"
  )
  if (length(version_line) == 0) {
    return("unknown")
  }
  testthat::expect_equal(1, length(version_line))
  version <- stringr::str_match(
    string = version_line,
    pattern = "GCAE.*(v[:digit:]+\\.[:graph:]+)"
  )[, 2]
  version
}
richelbilderbeek/gcaer documentation built on March 25, 2024, 3:08 p.m.