feat: better durations and allow stopping pomodoro
This commit is contained in:
parent
103c6d779e
commit
0c954962cc
7 changed files with 81 additions and 49 deletions
26
src/cli.rs
26
src/cli.rs
|
|
@ -3,6 +3,7 @@ use anyhow::{Context, Result};
|
|||
use clap::{Parser, Subcommand};
|
||||
use std::net::Shutdown;
|
||||
use std::os::unix::net::UnixStream;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(name = "timers")]
|
||||
|
|
@ -24,22 +25,29 @@ pub enum Command {
|
|||
},
|
||||
Add {
|
||||
name: String,
|
||||
duration_seconds: u64,
|
||||
duration: humantime::Duration,
|
||||
},
|
||||
List,
|
||||
Remove {
|
||||
name: String,
|
||||
},
|
||||
Pomodoro {
|
||||
#[clap(default_value_t = 25)]
|
||||
work_minutes: u64,
|
||||
#[clap(default_value_t = 5)]
|
||||
pause_minutes: u64,
|
||||
#[clap(default_value_t = 10)]
|
||||
long_pause_minutes: u64,
|
||||
#[command(subcommand)]
|
||||
Pomodoro(PomodoroCommand)
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum PomodoroCommand {
|
||||
Start {
|
||||
#[clap(default_value_t = Duration::from_secs(25 * 60).into())]
|
||||
work: humantime::Duration,
|
||||
#[clap(default_value_t = Duration::from_secs(5 * 60).into())]
|
||||
pause: humantime::Duration,
|
||||
#[clap(default_value_t = Duration::from_secs(10 * 60).into())]
|
||||
long_pause: humantime::Duration,
|
||||
#[clap(default_value_t = 3)]
|
||||
pauses_till_long: u64,
|
||||
}
|
||||
},
|
||||
Stop,
|
||||
}
|
||||
|
||||
fn get_stream(socket_path: &String) -> Result<UnixStream> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue