suppressMessages(source("tools/libs.R"))

# Retrieve recipe file path
args = commandArgs(trailingOnly = TRUE)
recipe_file <- args[1]

# Check recipe and prepare output directories
recipe <- prepare_outputs(recipe_file)
# Split recipe into atomic recipes

## TODO: Add autosubmit yes/no to the parameters?
run_parameters <- divide_recipe(recipe)
if (recipe$Run$autosubmit) {
  write_autosubmit_conf(recipe, run_parameters$n_atomic_recipes)
} else {
  run_parameters$outdir
}
