mirror of
https://framagit.org/ppom/reaction
synced 2026-03-14 20:55:47 +01:00
fix: merge plugins in configuration
This commit is contained in:
parent
fc46831a87
commit
ac114c7373
1 changed files with 14 additions and 0 deletions
|
|
@ -49,6 +49,20 @@ fn dot() -> String {
|
|||
|
||||
impl Config {
|
||||
fn merge(&mut self, mut other: Config) -> Result<(), String> {
|
||||
for (key, plugin) in other.plugins.into_iter() {
|
||||
match self.plugins.entry(key) {
|
||||
Entry::Vacant(e) => {
|
||||
e.insert(plugin);
|
||||
}
|
||||
Entry::Occupied(e) => {
|
||||
return Err(format!(
|
||||
"plugin {} is already defined. plugin definitions can't be spread accross multiple files.",
|
||||
e.key()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (key, pattern) in other.patterns.into_iter() {
|
||||
match self.patterns.entry(key) {
|
||||
Entry::Vacant(e) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue