summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authorNamilskyy <alive6863@gmail.com>2025-03-25 20:09:50 +0300
committerNamilskyy <alive6863@gmail.com>2025-03-25 20:09:50 +0300
commit0ac84bd50407f2c4747a64b5340003849439fa52 (patch)
treef0c905c04dc6bf0c21f6bd2e067c77a8a97f536a /src/main.rs
parentf2ef0f00b48c11f12dc49b9d1e0c27b589e78d87 (diff)
Fixed errors and bugs.
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs82
1 files changed, 24 insertions, 58 deletions
diff --git a/src/main.rs b/src/main.rs
index 73c8403..568ef9a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -11,76 +11,42 @@ mod configmanager;
use parser::{parse_weather, Weather};
use configmanager::{Config, handle_config};
+f// main.rs
+use clap::{Arg, Command};
+use termimage::Image;
+
+mod configmanager;
+mod parser;
+
+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)
- )
+ .about("Weather fetch like fastfetch with image and ASCII art support")
+ .arg(Arg::new("image").short('i').long("image").value_name("PATH"))
+ .arg(Arg::new("exclude")
+ .short('e')
+ .long("exclude")
+ .value_name("TYPE")
+ .possible_values(["current", "minutely", "hourly", "daily", "alerts"]))
+ .arg(Arg::new("help").short('h').long("help"))
+ .arg(Arg::new("lat").short('t').long("lat").value_name("LATITUDE"))
+ .arg(Arg::new("lon").short('n').long("lon").value_name("LONGITUDE"))
.get_matches();
-
- if matches.is_present("help") {
-
+ if matches.contains_id("help") {
+ println!("Usage: ...");
return Ok(());
}
-
- if let Some(img_path) = matches.value_of("image") {
- let img = Image::from_path(img_path)?;
-
+ if let Some(img_path) = matches.get_one::<String>("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(())
-}
-
+} \ No newline at end of file