From 8cf27d642c6e155bcfc4a4fab6e461aa4b50b5db Mon Sep 17 00:00:00 2001 From: SuperCuber Date: Sun, 26 Jun 2022 18:43:12 +0300 Subject: [PATCH] Apply modified patch from #102 Closes #102 --- src/config.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 17a8b7c..3ada024 100644 --- a/src/config.rs +++ b/src/config.rs @@ -330,8 +330,17 @@ fn merge_configuration_files( } for (variable_name, variable_value) in package.variables { - if first_package.variables.contains_key(&variable_name) { - anyhow::bail!("variable {:?} already encountered", variable_name); + if let Some(first_value) = first_package.variables.get_mut(&variable_name).as_mut() + { + match (first_value, variable_value) { + (toml::Value::Table(first_value), toml::Value::Table(variable_value)) => { + trace!("Merging {:?} tables", variable_name); + recursive_extend_map(first_value, variable_value); + } + _ => { + anyhow::bail!("variable {:?} already encountered", variable_name); + } + } } else { first_package .variables