feat: add command to list pomodoro
parent
98acf3c74e
commit
61b7bd447d
|
@ -76,6 +76,9 @@ pub enum PomodoroCommand {
|
||||||
/// Stop the pomodoro
|
/// Stop the pomodoro
|
||||||
#[clap(visible_alias="p")]
|
#[clap(visible_alias="p")]
|
||||||
Remove,
|
Remove,
|
||||||
|
/// List the pomodoro settings and remaining duration
|
||||||
|
#[clap(visible_alias="l")]
|
||||||
|
List,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_stream(socket_path: &String) -> Result<UnixStream> {
|
fn get_stream(socket_path: &String) -> Result<UnixStream> {
|
||||||
|
|
|
@ -23,6 +23,7 @@ pub enum Command {
|
||||||
pauses_till_long: u64,
|
pauses_till_long: u64,
|
||||||
},
|
},
|
||||||
PomodoroRemove,
|
PomodoroRemove,
|
||||||
|
PomodoroList,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
@ -148,7 +149,8 @@ impl Daemon {
|
||||||
Command::PomodoroRemove => {
|
Command::PomodoroRemove => {
|
||||||
self.pomodoro = None;
|
self.pomodoro = None;
|
||||||
Ok(Answer::Ok)
|
Ok(Answer::Ok)
|
||||||
},
|
}
|
||||||
|
Command::PomodoroList => Ok(Answer::Pomodoro(self.pomodoro.clone())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ fn main() -> Result<()> {
|
||||||
pauses_till_long,
|
pauses_till_long,
|
||||||
},
|
},
|
||||||
PomodoroCommand::Remove => DaemonCommand::PomodoroRemove,
|
PomodoroCommand::Remove => DaemonCommand::PomodoroRemove,
|
||||||
|
PomodoroCommand::List => DaemonCommand::PomodoroList,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
send_command(&args.socket, daemon_command)
|
send_command(&args.socket, daemon_command)
|
||||||
|
|
Loading…
Reference in New Issue