From 1f4b994b745ce5bdcddf71e995293f3e4ac44ce3 Mon Sep 17 00:00:00 2001 From: jenna-a2ai Date: Tue, 19 Nov 2024 19:41:39 +0000 Subject: [PATCH] makes options.yaml not required --- R/custom_options.R | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/R/custom_options.R b/R/custom_options.R index 68a0ff9..2606b2d 100644 --- a/R/custom_options.R +++ b/R/custom_options.R @@ -33,13 +33,19 @@ get_prepended_checklist_note <- function() { } get_options <- function() { - options_yaml <- file.path(.le$config_repo_path, "options.yaml") - options <- yaml::read_yaml(options_yaml) - - lapply(names(options), function(option_key) { - option_value <- options[[option_key]] - assign(option_key, option_value, envir = .le) + # put in tryCatch because file may not exist + tryCatch({ + options_yaml <- file.path(.le$config_repo_path, "options.yaml") + options <- yaml::read_yaml(options_yaml) + + lapply(names(options), function(option_key) { + option_value <- options[[option_key]] + assign(option_key, option_value, envir = .le) + }) + }, error = function(e) { + return() }) + } capitalize <- function(word) {