Compare commits
8 Commits
f413d5e2eb
...
v0.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 93c5c30021 | |||
| 6c8fc7268b | |||
| 53902af934 | |||
| 7a7ae1ffdb | |||
| d52422d839 | |||
| ac7b67748d | |||
| 361df64b04 | |||
| 6eddd02fb4 |
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "mould"
|
||||
version = "0.2.0"
|
||||
version = "0.2.1"
|
||||
edition = "2024"
|
||||
authors = ["Nils Pukropp <nils@narl.io>"]
|
||||
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 The mould Contributors
|
||||
Copyright (c) 2026 Nils Pukropp <nils@narl.io>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -121,14 +121,6 @@ impl FormatHandler for HierarchicalHandler {
|
||||
}
|
||||
|
||||
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());
|
||||
for var in vars {
|
||||
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("true"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user