feat: add documentation
This commit is contained in:
parent
0c954962cc
commit
98acf3c74e
4 changed files with 52 additions and 24 deletions
38
src/cli.rs
38
src/cli.rs
|
|
@ -5,10 +5,9 @@ use std::net::Shutdown;
|
|||
use std::os::unix::net::UnixStream;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[derive(Parser)]
|
||||
#[command(name = "timers")]
|
||||
#[command(about = "A advanced timer daemon/cli.", long_about = None)]
|
||||
#[command(arg_required_else_help = true)]
|
||||
/// A advanced timer daemon/cli.
|
||||
pub struct Cli {
|
||||
#[command(subcommand)]
|
||||
pub command: Command,
|
||||
|
|
@ -19,35 +18,64 @@ pub struct Cli {
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum Command {
|
||||
/// Run as daemon
|
||||
#[clap(visible_alias="d")]
|
||||
Daemon {
|
||||
/// do not send notifications
|
||||
#[arg(short, long)]
|
||||
notify: bool,
|
||||
no_notify: bool,
|
||||
},
|
||||
/// Add a timer
|
||||
#[clap(visible_alias="a")]
|
||||
Add {
|
||||
/// name of the timer
|
||||
name: String,
|
||||
/// duration of the timer
|
||||
duration: humantime::Duration,
|
||||
},
|
||||
/// List timers
|
||||
#[clap(visible_alias="l")]
|
||||
List,
|
||||
/// Remove a timer
|
||||
#[clap(visible_alias="r")]
|
||||
Remove {
|
||||
/// name of the timer to remove
|
||||
name: String,
|
||||
},
|
||||
/// Pomodoro specific command
|
||||
#[command(subcommand)]
|
||||
#[clap(visible_alias="p")]
|
||||
Pomodoro(PomodoroCommand)
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum PomodoroCommand {
|
||||
/// Start pomodoro
|
||||
#[clap(visible_alias="s")]
|
||||
Start {
|
||||
/// duration to work for
|
||||
#[arg(long)]
|
||||
#[clap(default_value_t = Duration::from_secs(25 * 60).into())]
|
||||
work: humantime::Duration,
|
||||
|
||||
/// duration for short pauses
|
||||
#[arg(long)]
|
||||
#[clap(default_value_t = Duration::from_secs(5 * 60).into())]
|
||||
pause: humantime::Duration,
|
||||
|
||||
/// duration for long pauses
|
||||
#[arg(long)]
|
||||
#[clap(default_value_t = Duration::from_secs(10 * 60).into())]
|
||||
long_pause: humantime::Duration,
|
||||
|
||||
/// number of short pauses till long pause
|
||||
#[arg(long)]
|
||||
#[clap(default_value_t = 3)]
|
||||
pauses_till_long: u64,
|
||||
},
|
||||
Stop,
|
||||
/// Stop the pomodoro
|
||||
#[clap(visible_alias="p")]
|
||||
Remove,
|
||||
}
|
||||
|
||||
fn get_stream(socket_path: &String) -> Result<UnixStream> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue