Skip to content

Commit e091faa

Browse files
committed
enable echo warning whe nget default value
1 parent 2342eea commit e091faa

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

R/context/set_config.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const set_config = function(configs = list()) {
3838
#' a type cast function expression invoke example as:
3939
#' ``as.logical``, ``as.double``, etc maybe required.
4040
#'
41-
const get_config = function(name, default = NULL) {
41+
const get_config = function(name, default = NULL, warn_msg = NULL) {
4242
const path = strsplit(name, "$", fixed = TRUE);
4343
const verbose = as.logical(getOption("verbose"));
4444

@@ -60,7 +60,16 @@ const get_config = function(name, default = NULL) {
6060
}
6161
}
6262

63-
return(config || default);
63+
if (is.null(warn_msg)) {
64+
return(config || default);
65+
} else {
66+
if (is.null(config)) {
67+
echo_warning(warn_msg);
68+
default;
69+
} else {
70+
config;
71+
}
72+
}
6473
}
6574

6675
#' pull all configuration value from workflow registry

0 commit comments

Comments
 (0)