Skip to content

Commit

Permalink
Merge pull request #22 from tadascience/check_model
Browse files Browse the repository at this point in the history
check_model() uses rlang::arg_match()
  • Loading branch information
romainfrancois authored Mar 12, 2024
2 parents d0e7e93 + cf359cf commit 61f9ada
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions R/models.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ models <- function(error_call = caller_env(), dry_run = FALSE) {
}

check_model <- function(model, error_call = caller_env()) {
available_models <- models(error_call = error_call)

if (!(model %in% available_models)) {
cli_abort(call = error_call, c(
"The model {model} is not available.",
"i" = "Please use the {.code models()} function to see the available models."
))
}

candidates <- models(error_call = error_call)
arg_match(model, values = candidates, error_call = error_call)
invisible(model)
}

0 comments on commit 61f9ada

Please sign in to comment.