]> git.r.bdr.sh - rbdr/lyricli/blobdiff - src/configuration.rs
Run lint / format
[rbdr/lyricli] / src / configuration.rs
index f6784618490162c6a5f667c3be3561cb5276c2c9..56d60d93c41280e5a992e8798fba7cae122f7049 100644 (file)
@@ -1,25 +1,23 @@
+use serde::{Deserialize, Serialize};
+use serde_json;
 use std::env;
 use std::fs::{create_dir_all, write, File};
 use std::io::{Read, Result};
 use std::path::PathBuf;
 use std::env;
 use std::fs::{create_dir_all, write, File};
 use std::io::{Read, Result};
 use std::path::PathBuf;
-use serde::{Deserialize, Serialize};
-use serde_json;
 
 const CONFIG_ENV_VARIABLE: &str = "LYRICLI_CONFIG_DIRECTORY";
 const CONFIG_DEFAULT_LOCATION: &str = "XDG_CONFIG_HOME";
 const CONFIG_FALLBACK_LOCATION: &str = ".config";
 
 const CONFIG_ENV_VARIABLE: &str = "LYRICLI_CONFIG_DIRECTORY";
 const CONFIG_DEFAULT_LOCATION: &str = "XDG_CONFIG_HOME";
 const CONFIG_FALLBACK_LOCATION: &str = ".config";
-const CONFIG_SUBDIRECTORY: &str = ".config";
+const CONFIG_SUBDIRECTORY: &str = "lyricli";
 const CONFIG_FILENAME: &str = "lyricli.conf";
 
 #[derive(Serialize, Deserialize, Debug)]
 pub struct Configuration {
 const CONFIG_FILENAME: &str = "lyricli.conf";
 
 #[derive(Serialize, Deserialize, Debug)]
 pub struct Configuration {
-    enabled_sources: Vec<String>
+    enabled_sources: Vec<String>,
 }
 
 impl Configuration {
 }
 
 impl Configuration {
-
-    pub fn new() -> Self  {
-
+    pub fn new() -> Self {
         if let Some(configuration) = Configuration::read() {
             return configuration;
         }
         if let Some(configuration) = Configuration::read() {
             return configuration;
         }
@@ -55,8 +53,9 @@ impl Configuration {
         Configuration {
             enabled_sources: vec![
                 "apple_music".to_string(),
         Configuration {
             enabled_sources: vec![
                 "apple_music".to_string(),
-                "spotify".to_string()
-            ]
+                "spotify".to_string(),
+                "strawberry".to_string(),
+            ],
         }
     }
 
         }
     }
 
@@ -90,9 +89,13 @@ impl Configuration {
                 Ok(directory) => PathBuf::from(directory),
                 Err(_) => match env::var("HOME") {
                     Ok(directory) => PathBuf::from(directory).join(CONFIG_FALLBACK_LOCATION),
                 Ok(directory) => PathBuf::from(directory),
                 Err(_) => match env::var("HOME") {
                     Ok(directory) => PathBuf::from(directory).join(CONFIG_FALLBACK_LOCATION),
-                    Err(_) => panic!("Could not find required directory, {} or {} should be set and readable.", CONFIG_ENV_VARIABLE, CONFIG_DEFAULT_LOCATION),
+                    Err(_) => panic!(
+                        "Could not find required directory, {} or {} should be set and readable.",
+                        CONFIG_ENV_VARIABLE, CONFIG_DEFAULT_LOCATION
+                    ),
                 },
             },
                 },
             },
-        }.join(CONFIG_SUBDIRECTORY)
+        }
+        .join(CONFIG_SUBDIRECTORY)
     }
 }
     }
 }