From 0ac84bd50407f2c4747a64b5340003849439fa52 Mon Sep 17 00:00:00 2001 From: Namilskyy Date: Tue, 25 Mar 2025 20:09:50 +0300 Subject: Fixed errors and bugs. --- src/parser.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/parser.rs') diff --git a/src/parser.rs b/src/parser.rs index 62af697..f9976e6 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -130,17 +130,24 @@ pub struct Alert { -pub fn get_location(let ip: String) -> Reslut<(), >{ +pub fn get_location(let coords_args: bool, config: &Config) -> Reslut<(), >{ //Get the lat and lon for API call - if configmanager::Config.lat.is_empty() || configmanager::Config.lon.is_empty(){ + configmanager::handle_config(); + if configmanager::Config.lat.is_empty() || configmanager::Config.lon.is_empty() && !coords_args{ println!("No coordinates in configuration file or conf not founded."); println!("HINT: Try create ~/.config/WeatherFetch/Config.toml"); - println!("HINT: And add `lat(, )`, `lon(, )`."); + println!("HINT: And add `lat()`, `lon()`."); println!("HINT: To get more info check https://openweathermap.org/api/one-call-3") + + Err("No coordinates in config or args.".into()) + } else { + Ok(()) } } -async pub fn parse_wheather() -> Result<(), Error>{ -} +pub async fn parse_weather(config: &Config) -> Result<(), reqwest::Error> { + + Ok(()) +} \ No newline at end of file -- cgit v1.2.3