2020-05-22 02:07:19 +00:00
|
|
|
use async_std::task;
|
2020-05-21 06:03:38 +00:00
|
|
|
use clap::{App, ArgMatches, SubCommand};
|
2020-05-22 02:07:19 +00:00
|
|
|
use domasi::pomodoro::{Alert, Config};
|
2020-05-21 06:03:38 +00:00
|
|
|
use domasi::Pomodoro;
|
2020-05-22 02:07:19 +00:00
|
|
|
|
2020-05-21 04:04:31 +00:00
|
|
|
fn main() {
|
2020-05-21 06:03:38 +00:00
|
|
|
let matches = App::new("Domasi")
|
|
|
|
.version("0.1.0")
|
|
|
|
.author("paoda <musukarekai@gmail.com>")
|
|
|
|
.about("Yet another pomodoro timer.")
|
|
|
|
.subcommand(SubCommand::with_name("start").about("Start the Pomodoro Timer"))
|
|
|
|
.get_matches();
|
|
|
|
|
|
|
|
match matches.subcommand() {
|
2020-05-22 02:07:19 +00:00
|
|
|
("start", Some(sub_matches)) => start(sub_matches),
|
2020-05-21 06:03:38 +00:00
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-22 02:07:19 +00:00
|
|
|
pub fn start(_args: &ArgMatches) {
|
2020-05-21 06:03:38 +00:00
|
|
|
let config = Config::default();
|
|
|
|
|
2020-05-22 02:07:19 +00:00
|
|
|
let audio_path = config.data_directory.join("sound/alert.ogg");
|
|
|
|
let default_device = rodio::default_output_device().unwrap();
|
|
|
|
let alert = Alert::new(&audio_path, &default_device);
|
|
|
|
let mut pomodoro = Pomodoro::new(&alert);
|
|
|
|
|
|
|
|
task::block_on(async {
|
|
|
|
pomodoro.start(config).await;
|
|
|
|
});
|
2020-05-21 04:04:31 +00:00
|
|
|
}
|