library: pretty-print json config file

This commit is contained in:
Polochon-street 2022-10-16 21:49:41 +02:00
parent 10cddd64a3
commit e51c242a48
4 changed files with 10 additions and 4 deletions

View file

@ -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`.

2
Cargo.lock generated
View file

@ -96,7 +96,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bliss-audio"
version = "0.6.4"
version = "0.6.5"
dependencies = [
"anyhow",
"bliss-audio-aubio-rs",

View file

@ -1,6 +1,6 @@
[package]
name = "bliss-audio"
version = "0.6.4"
version = "0.6.5"
authors = ["Polochon-street <polochonstreet@gmx.fr>"]
edition = "2018"
license = "GPL-3.0-only"

View file

@ -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<String> {
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!(