feat: add daemonize to fork off

This commit is contained in:
Moritz Böhme 2023-07-29 17:19:36 +02:00
parent b53689584a
commit 0727b3e053
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9
3 changed files with 16 additions and 2 deletions

View file

@ -1,8 +1,8 @@
mod cli;
mod daemon;
mod notification;
mod pomodoro;
mod timer;
mod notification;
use crate::cli::{send_command, Cli, Command as CliCommand};
use crate::daemon::{Command as DaemonCommand, Daemon};
@ -12,7 +12,10 @@ use cli::PomodoroCommand;
fn main() -> Result<(), anyhow::Error> {
let args = Cli::parse();
let daemon_command = match args.command {
CliCommand::Daemon { no_notify } => return Daemon::new(args.socket, no_notify)?.run(),
CliCommand::Daemon { no_notify } => {
daemonize::Daemonize::new().start()?;
return Daemon::new(args.socket, no_notify)?.run();
}
CliCommand::Add { name, duration } => {
DaemonCommand::Add(name.into_boxed_str(), duration.into())
}