removed old comment
Some checks failed
Version Check / check-version (pull_request) Failing after 4s

This commit is contained in:
2026-03-16 17:59:10 +01:00
parent f413d5e2eb
commit 7a7ae1ffdb

View File

@@ -121,14 +121,6 @@ impl FormatHandler for HierarchicalHandler {
} }
fn write(&self, path: &Path, vars: &[EnvVar]) -> io::Result<()> { fn write(&self, path: &Path, vars: &[EnvVar]) -> io::Result<()> {
// For writing hierarchical formats, we ideally want to preserve the original structure.
// But we don't have it here. We should parse the template again to get the structure!
// Oh wait, `write` is called with only `vars`.
// If we want to construct the tree from scratch, it's very difficult to guess array vs object
// and data types without the original template.
// Let's change the trait or just keep a copy of the template?
// Actually, if we require the user to have the template, we can just parse the template, update the leaves, and write.
// We'll write a reconstruction algorithm that just creates objects based on keys.
let mut root = Value::Object(Map::new()); let mut root = Value::Object(Map::new());
for var in vars { for var in vars {
insert_into_value(&mut root, &var.key, &var.value); insert_into_value(&mut root, &var.key, &var.value);
@@ -246,4 +238,4 @@ mod tests {
assert!(unflattened_json.contains("\"8080:80\"")); assert!(unflattened_json.contains("\"8080:80\""));
assert!(unflattened_json.contains("true")); assert!(unflattened_json.contains("true"));
} }
} }