chiark / gitweb /
wip parsing
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 23 Jul 2021 21:58:13 +0000 (22:58 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 23 Jul 2021 21:58:25 +0000 (22:58 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/config.rs

index e5c06cbbd6436ca9405de4450efe52aef1070138..58ffd6cbdf4f89ce79abf1fffa096fef6ec354b2 100644 (file)
@@ -67,7 +67,7 @@ pub enum SectionName {
 }
 pub use SectionName as SN;
 
-type SectionMap = HashMap<String, Option<String>>;
+type SectionMap = HashMap<SectionName, Option<String>>;
 
 pub struct Config {
   opts: Opts,
@@ -137,7 +137,12 @@ impl Aggregate {
     // xxx parse section names here
     // xxx save Arc<PathBuf> where we found each item
 
-    self.sections.extend(map.drain());
+    for (sn, vars) in map.drain() {
+      let sn = sn.parse().dcontext(&sn)?;
+      self.sections.entry(sn)
+        .or_default()
+        .extend(vars);
+    }
     None
   }