release/0.2.1 #5

Merged
nvrl merged 5 commits from release/0.2.1 into main 2026-03-16 18:00:02 +01:00
Showing only changes of commit 7a7ae1ffdb - Show all commits

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"));
} }
} }