cosmic-config: pretty print config file data

This commit is contained in:
Jeremy Soller 2024-01-12 09:40:49 -07:00
parent 5ae1ac2abd
commit 07c88fe574
No known key found for this signature in database
GPG key ID: DCFCA852D3906975

View file

@ -314,7 +314,7 @@ impl<'a> ConfigSet for ConfigTransaction<'a> {
fn set<T: Serialize>(&self, key: &str, value: T) -> Result<(), Error> { fn set<T: Serialize>(&self, key: &str, value: T) -> Result<(), Error> {
//TODO: sanitize key (no slashes, cannot be . or ..) //TODO: sanitize key (no slashes, cannot be . or ..)
let key_path = self.config.key_path(key)?; let key_path = self.config.key_path(key)?;
let data = ron::to_string(&value)?; let data = ron::ser::to_string_pretty(&value, ron::ser::PrettyConfig::new())?;
//TODO: replace duplicates? //TODO: replace duplicates?
{ {
let mut updates = self.updates.lock().unwrap(); let mut updates = self.updates.lock().unwrap();