Skip to content

Commit

Permalink
enable echo warning whe nget default value
Browse files Browse the repository at this point in the history
  • Loading branch information
xieguigang committed Dec 17, 2024
1 parent 2342eea commit e091faa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions R/context/set_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const set_config = function(configs = list()) {
#' a type cast function expression invoke example as:
#' ``as.logical``, ``as.double``, etc maybe required.
#'
const get_config = function(name, default = NULL) {
const get_config = function(name, default = NULL, warn_msg = NULL) {
const path = strsplit(name, "$", fixed = TRUE);
const verbose = as.logical(getOption("verbose"));

Expand All @@ -60,7 +60,16 @@ const get_config = function(name, default = NULL) {
}
}

return(config || default);
if (is.null(warn_msg)) {
return(config || default);
} else {
if (is.null(config)) {
echo_warning(warn_msg);
default;
} else {
config;
}
}
}

#' pull all configuration value from workflow registry
Expand Down

0 comments on commit e091faa

Please sign in to comment.