Skip to content

Commit

Permalink
feat: implement cli
Browse files Browse the repository at this point in the history
  • Loading branch information
iahmadgad committed Oct 25, 2024
1 parent 2901853 commit a006c01
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,72 @@ mod frontend;
mod termux;
mod android;

use termux::*;
use android::*;
use frontend::*;

use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
struct Args {
#[command(subcommand)]
cmd: Commands,
}

#[derive(Subcommand, Debug, Clone)]
enum Commands {
Timer {
#[arg(short, long)]
length: Option<u32>,

#[arg(short, long)]
message: Option<String>,

#[arg(short, long)]
termux: bool,
},

Alarm {
#[arg(short = 'H', long)]
hour: Option<u32>,

#[arg(short = 'M', long)]
minutes: Option<u32>,

#[arg(short, long, value_delimiter = ' ')]
days: Option<Vec<u32>>,

#[arg(short, long)]
message: Option<String>,

#[arg(short, long)]
vibrate: Option<bool>,

#[arg(short, long)]
termux: bool,
}
}

fn main() {
todo!();
let args = Args::parse();
match args.cmd {
Commands::Timer{length, message, termux} => {
if termux {
Termux::set_timer(length, message)
}
else {
Android::set_timer(length, message)
}
}
Commands::Alarm{hour, minutes, days, message, vibrate, termux} => {
if termux {
Termux::set_alarm(hour, minutes, days, message, vibrate)
}
else {
Android::set_alarm(hour, minutes, days, message, vibrate)
}
}
_ => ()
}
}

0 comments on commit a006c01

Please sign in to comment.