From 61b7bd447da4de112787fd7c457dd942f860334c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 29 Jul 2023 16:02:42 +0200 Subject: [PATCH] feat: add command to list pomodoro --- src/cli.rs | 3 +++ src/daemon.rs | 4 +++- src/main.rs | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cli.rs b/src/cli.rs index e06ab68..fb498bc 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -76,6 +76,9 @@ pub enum PomodoroCommand { /// Stop the pomodoro #[clap(visible_alias="p")] Remove, + /// List the pomodoro settings and remaining duration + #[clap(visible_alias="l")] + List, } fn get_stream(socket_path: &String) -> Result { diff --git a/src/daemon.rs b/src/daemon.rs index 02786e6..41fa1cd 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -23,6 +23,7 @@ pub enum Command { pauses_till_long: u64, }, PomodoroRemove, + PomodoroList, } #[derive(Debug, Serialize, Deserialize)] @@ -148,7 +149,8 @@ impl Daemon { Command::PomodoroRemove => { self.pomodoro = None; Ok(Answer::Ok) - }, + } + Command::PomodoroList => Ok(Answer::Pomodoro(self.pomodoro.clone())), } } diff --git a/src/main.rs b/src/main.rs index 7a8e9a0..72bfe2d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,6 +31,7 @@ fn main() -> Result<()> { pauses_till_long, }, PomodoroCommand::Remove => DaemonCommand::PomodoroRemove, + PomodoroCommand::List => DaemonCommand::PomodoroList, }, }; send_command(&args.socket, daemon_command)