summaryrefslogtreecommitdiff
path: root/src/configmanager.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/configmanager.rs')
-rw-r--r--src/configmanager.rs40
1 files changed, 17 insertions, 23 deletions
diff --git a/src/configmanager.rs b/src/configmanager.rs
index fb8ccc1..0bbbb73 100644
--- a/src/configmanager.rs
+++ b/src/configmanager.rs
@@ -3,25 +3,23 @@ use serde::Deserialize;
use dirs::home_dir;
use std::path::PathBuf;
-impl WeatherFetch{
-#[derive(Deserialize)]
+#[derive(Debug, Deserialize)]
pub struct Config {
- lat: String, //Latitude, decimal (-90; 90)
- lon: String, //Longitude, decimal (-180; 180)
- exclude: String, //By using this parameter you can exclude some parts of the weather
- appid: String, //Your OpenWeatherMap API key
- lang: String, //Output language
- units: String, //Units of measurement
- cache: bool, //Cacheing next Weather to dont use internet in next call
- rain: String, //Path to rain image (png/jpg) or ASCII art int .txt
- sunny: String, //Path to sunny image (png/jpg) or ASCII art int .txt
- snowy: String,
+ pub lat: String,
+ pub lon: String,
+ pub exclude: String,
+ pub appid: String,
+ pub lang: String,
+ pub units: String,
+ pub cache: bool,
+ pub rain: String,
+ pub sunny: String,
+ pub snowy: String,
}
- //More info: OpenWeatherMap.org/api/one-call3
-impl Config{
+impl Config {
pub fn load() -> Result<Self, Box<dyn std::error::Error>> {
- let mut path = home_dir().ok_or("Не удалось найти домашнюю директорию")?;
+ let mut path = home_dir().ok_or("Home directory not found")?;
path.push(".config/WeatherFetch/Config.toml");
let config_str = fs::read_to_string(path)?;
@@ -30,14 +28,10 @@ impl Config{
}
}
-pub fn handle_config(config: &Config) -> Result<(), Box<dyn std::error::Error>> {
- // Пока недоделано
+pub fn handle_config(_config: &Config) -> Result<(), Box<dyn std::error::Error>> {
Ok(())
}
-pub fn gen_standart_conf() {
-
-}
-
-}
-
+pub fn gen_standard_conf() {
+ // TODO: Implement
+} \ No newline at end of file