krata: reconcile improvements and better kratactl error experience

This commit is contained in:
Alex Zenla
2024-03-23 07:00:12 +00:00
parent df90a4d03f
commit 3d5095c78b
12 changed files with 119 additions and 62 deletions

View File

@ -49,3 +49,10 @@ pub fn proto2kv(proto: impl ReflectMessage) -> Result<HashMap<String, String>> {
Ok(map)
}
pub fn kv2line(map: HashMap<String, String>) -> String {
map.iter()
.map(|(k, v)| format!("{}=\"{}\"", k, v.replace('"', "\\\"")))
.collect::<Vec<_>>()
.join(" ")
}