praytimes_kit/
lib.rs

1mod base;
2mod commands;
3use clap::{Parser, Subcommand};
4#[derive(Parser, Debug, Clone)]
5pub struct Args {
6    #[command(subcommand)]
7    command: SubCommands,
8}
9
10#[derive(Subcommand, Debug, Clone)]
11pub enum SubCommands {
12    /// http API for praytime calculation
13    Serve,
14    /// simple cli to show praytimes for specific day
15    Calculate(commands::calculate::Args),
16
17    /// daemon which helps with notification and similar works on praytimes
18    Daemon(commands::daemon::Args),
19
20    /// get next praytime event 
21    Next(commands::next::Args)
22}
23
24pub async fn run(args: Args) {
25    match args.command {
26        SubCommands::Serve => commands::serve::serve().await,
27        SubCommands::Calculate(c) => commands::calculate::run(c),
28        SubCommands::Daemon(d) => commands::daemon::run(d).await,
29        SubCommands::Next(n) => commands::next::run(n),
30    }
31}