use clap::Parser;
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
#[command(subcommand)]
cmd: Option<Commands>,
}
#[derive(Parser, Debug)]
enum Commands {
Start,
Stop,
Restart,
#[command(long_about = "keybindings...")]
Config,
}
fn main() {
let args = Args::parse();
if let Some(cmd) = args.cmd {
let service = srhd::service::Service::new();
use Commands::*;
match cmd {
Start => service.start().expect("Failed to start service"),
Stop => service.stop().expect("Failed to stop service"),
Restart => service.restart().expect("Failed to restart service"),
Config => println!(".config/srhd/srhd.toml"),
}
} else {
srhd::listener::srhd_process();
}
}