fix(config): Improve output from --dump-config

This commit is contained in:
Ed Page 2021-04-07 20:49:30 -05:00
parent 8d02a86f2f
commit b8294d7afa

View file

@ -131,6 +131,26 @@ impl<'s> ConfigEngine<'s> {
config.update(overrides); config.update(overrides);
} }
let mut types = Default::default();
std::mem::swap(&mut types, &mut config.type_);
let mut types = types
.into_iter()
.map(|(type_, type_engine)| {
let mut new_engine = config.default.clone();
new_engine.update(&type_engine.engine);
new_engine.update(&config.overrides);
let new_type_engine = crate::config::TypeEngineConfig {
extend_glob: type_engine.extend_glob,
engine: new_engine,
};
(type_, new_type_engine)
})
.collect();
std::mem::swap(&mut types, &mut config.type_);
config.default.update(&config.overrides);
Ok(config) Ok(config)
} }
@ -167,10 +187,7 @@ impl<'s> ConfigEngine<'s> {
} }
} }
let mut new_type_engine = default.clone(); let type_config = self.init_file_config(type_engine.engine);
new_type_engine.update(&type_engine.engine);
new_type_engine.update(&overrides);
let type_config = self.init_file_config(new_type_engine);
types.insert(type_name, type_config); types.insert(type_name, type_config);
} }
default.update(&overrides); default.update(&overrides);