From e51c242a4813910d5a14fef049723158118bb1a7 Mon Sep 17 00:00:00 2001 From: Polochon-street Date: Sun, 16 Oct 2022 21:49:41 +0200 Subject: [PATCH] library: pretty-print json config file --- CHANGELOG.md | 3 +++ Cargo.lock | 2 +- Cargo.toml | 2 +- src/library.rs | 7 +++++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5954f3..f80181f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ #Changelog +## bliss 0.6.5 +* Pretty-print JSON in the config file. + ## bliss 0.6.4 * Fix a bug in the customizable CPU number option in `library`. diff --git a/Cargo.lock b/Cargo.lock index 8ad6631..7ed3a21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -96,7 +96,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bliss-audio" -version = "0.6.4" +version = "0.6.5" dependencies = [ "anyhow", "bliss-audio-aubio-rs", diff --git a/Cargo.toml b/Cargo.toml index e32bd00..6269a52 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bliss-audio" -version = "0.6.4" +version = "0.6.5" authors = ["Polochon-street "] edition = "2018" license = "GPL-3.0-only" diff --git a/src/library.rs b/src/library.rs index 97c3dc2..86cc96f 100644 --- a/src/library.rs +++ b/src/library.rs @@ -166,7 +166,7 @@ pub trait AppConfigTrait: Serialize + Sized + DeserializeOwned { /// using for example the various Serde libraries (`serde_yaml`, etc) - /// just overwrite this method. fn serialize_config(&self) -> Result { - Ok(serde_json::to_string(&self)?) + Ok(serde_json::to_string_pretty(&self)?) } /// Set the number of desired cores for analysis, and write it to the @@ -2724,7 +2724,10 @@ mod test { #[test] fn test_library_new_default_write() { let (library, _temp_dir, _) = setup_test_library(); - let config_content = fs::read_to_string(&library.config.base_config().config_path).unwrap(); + let config_content = fs::read_to_string(&library.config.base_config().config_path) + .unwrap() + .replace(' ', "") + .replace('\n', ""); assert_eq!( config_content, format!(