domasi/src/main.rs

32 lines
909 B
Rust
Raw Normal View History

use async_std::task;
2020-05-21 06:03:38 +00:00
use clap::{App, ArgMatches, SubCommand};
use domasi::pomodoro::{Alert, Config};
2020-05-21 06:03:38 +00:00
use domasi::Pomodoro;
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() {
("start", Some(sub_matches)) => start(sub_matches),
2020-05-21 06:03:38 +00:00
_ => {}
}
}
pub fn start(_args: &ArgMatches) {
2020-05-21 06:03:38 +00:00
let config = Config::default();
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
}