use async_std::task; use clap::{App, ArgMatches, SubCommand}; use domasi::pomodoro::{Alert, Config}; use domasi::Pomodoro; fn main() { let matches = App::new("Domasi") .version("0.1.0") .author("paoda ") .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), _ => {} } } pub fn start(_args: &ArgMatches) { 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; }); }