summaryrefslogtreecommitdiff
path: root/src/parser.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.rs')
-rw-r--r--src/parser.rs17
1 files changed, 12 insertions, 5 deletions
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(<int>, <int>)`, `lon(<int>, <int>)`.");
+ println!("HINT: And add `lat(<int>)`, `lon(<int>)`.");
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