Version 0.2.0 #2

Merged
Thelie merged 15 commits from garbage into main 2021-05-23 22:47:43 +02:00
Showing only changes of commit d5353fb019 - Show all commits

View file

@ -168,9 +168,37 @@ fn handle_message(message: Message) -> Option<Message> {
}
fn main() {
let config_path = args().nth(1)
.expect("no config given");
let config = get_config(config_path).expect("Could not get config");
let mut server_conf_flag = false;
let mut config_path = None;
let mut server_conf_path = None;
for arg in args().skip(1) {
match arg.as_str() {
"-s" => server_conf_flag = true,
"-h" => {
println!("Usage: mention2mail [config file] [-s server config directory]");
},
_ => if server_conf_flag {
server_conf_path = Some(arg);
} else {
config_path = Some(arg);
}
}
}
let mut config;
match config_path {
Some(p) => config = get_config(p)
.expect("Could not get config"),
None => config = get_config("/etc/Mention2Mail/config.toml")
.expect("Could not get default config in /etc/Mention2Mail/default.toml"),
}
match server_conf_path {
Some(p) => config = get_server_config(config, p)
.expect("Could not get server config."),
None => (),
}
let mut stream = connect::connect_irc(&config).unwrap();