summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorNamilskyy <alive6863@gmail.com>2025-03-24 21:42:48 +0300
committerNamilskyy <alive6863@gmail.com>2025-03-24 21:43:40 +0300
commit667a259c981df9f08c49d4fe83fc2f907be06784 (patch)
tree3453e544a913339107b8a6bcb9269e69ab5a57f8 /src/main.rs
parent8ccbfad0cc8ecdcdccaa8766a7316b6a56d5e615 (diff)
Start dev
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
new file mode 100644
index 0000000..5119def
--- /dev/null
+++ b/src/main.rs
@@ -0,0 +1,86 @@
+//In developing 🏗️
+
+use serde::{Serialize, Deserialize};
+use std::{env, path::Path};
+use clap::{Arg, Command};
+use termimage::{Image};
+
+mod parser;
+mod configmanagerж
+
+use parser::{parse_weather, Weather};
+use configmanager::{Config, handle_config};
+
+fn main() -> Result<(), Box<dyn std::error::Error>> {
+
+ let matches = Command::new("WeatherFetch")
+ .version("0.1")
+ .author("Borisov Alexey <arcanetmodl@gmail.com>")
+ .about("Weather fetch like fastfetch with image and ASCII art support. Just useless pet project.")
+ .arg(
+ Arg::new("image")
+ .short("i")
+ .long("image")
+ .value_name("PATH")
+ .help("Path to image file")
+ .takes_value(true),
+ )
+ .arg(
+ Arg::new("exclude")
+ .short("e")
+ .long("exclude")
+ .value_name("TYPE")
+ .possible_values(["current", "minutely", "hourly", "daily", "alerts"])
+ .help("Exclude specific weather data type")
+ .takes_value(true),
+ )
+ .arg(
+ Arg::new("help")
+ .short("h")
+ .long("help")
+ .help("Print help information")
+ .takes_value(false),
+ )
+ .arg(
+ Arg::new(lat)
+ .short("lt")
+ .long("lat")
+ .value_name("TWO DIGITS")
+ .help("Coordinates for weather API call. Latitude.")
+ .takes_value(true)
+ )
+ .arg(
+ Arg::new("lon")
+ .short("ln")
+ .long("lon")
+ .value_name("TWO DIGITS")
+ .help("Coordinates for weather API call. Latitude.")
+ .takes_value(true)
+ )
+ .get_matches();
+
+
+ if matches.is_present("help") {
+
+ return Ok(());
+ }
+
+
+ if let Some(img_path) = matches.value_of("image") {
+ let img = Image::from_path(img_path)?;
+
+ }
+
+
+ if let Some(exclude_type) = matches.value_of("exclude") {
+
+
+ }
+
+
+ let config = Config::load()?;
+ handle_config(&config)?;
+
+ Ok(())
+}
+