mirror of
https://github.com/davegallant/rfd-notify.git
synced 2025-08-07 17:12:27 +00:00
Add initial (#1)
This commit is contained in:
38
src/main.rs
Normal file
38
src/main.rs
Normal file
@@ -0,0 +1,38 @@
|
||||
extern crate pretty_env_logger;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate crypto;
|
||||
mod config;
|
||||
mod db;
|
||||
mod mail;
|
||||
mod rfd;
|
||||
|
||||
use std::env;
|
||||
|
||||
fn help() {
|
||||
println!(
|
||||
"usage:\n
|
||||
rfd-notify <config-toml>
|
||||
Specify the filepath of the config."
|
||||
);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
pretty_env_logger::init();
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
||||
match args.len() {
|
||||
2 => {
|
||||
let config_path = &args[1];
|
||||
let config = config::parse(config_path);
|
||||
debug!("{:?}\n", config);
|
||||
let hot_deals = rfd::get_hot_deals().map_err(|err| error!("{:?}", err)).ok();
|
||||
let parsed_deals = rfd::parse_hot_deals(&hot_deals.unwrap());
|
||||
rfd::match_deals(parsed_deals, config)
|
||||
}
|
||||
_ => {
|
||||
help();
|
||||
}
|
||||
}
|
||||
info!("Complete")
|
||||
}
|
Reference in New Issue
Block a user