From ef6e3a4006522da925004fdcbbc531c520844fb6 Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Wed, 10 Sep 2025 01:11:33 +0530 Subject: Added help message --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 20 ++++++++++++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5700523..dd240e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "polydoro" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bincode", ] diff --git a/Cargo.toml b/Cargo.toml index 74ededa..1408682 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ homepage = "https://git.vidhukant.com/polydoro/about" repository = "https://git.vidhukant.com/polydoro" readme = "README.md" keywords = ["pomodoro", "polybar", "statusbar", "widget", "lemonbar"] -version = "0.1.0" +version = "0.1.1" edition = "2024" [dependencies] diff --git a/src/main.rs b/src/main.rs index b66df77..6042929 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,20 @@ use std::env; mod client; mod daemon; +fn print_usage() { + println!("Polydoro - Pomodoro widget for polybar and friends\n"); + println!("Usage:"); + println!("\tUse the -d flag to start the daemon (only one daemon can be running)"); + println!("\tUse the -l flag to listen to the daemon. Use this to print to your status bar/script."); + println!("\trun:\t\tStart/resume the timer"); + println!("\tpause:\t\tPause the timer"); + println!("\ttoggle:\t\tConditionally run/pause"); + println!("\tskip:\t\tSkip the current timer (timer needs to be in a running state)"); + println!("\tsoft-reset:\tGo to the beginning of the current timer"); + println!("\thard-reset:\tGo to the beginning of the first timer"); + println!("\treset:\t\tConditional soft/hard reset"); +} + fn main() { let args: Vec = env::args().collect(); @@ -28,9 +42,11 @@ fn main() { "run" | "pause" | "toggle" | "skip" | "soft-reset" | "hard-reset" | "reset" => client::command::handle_command(args[1].clone()), "-d" => daemon::start_daemon(), "-l" => client::listener::start_listener(), - "-h" | _ => eprintln!(""), + "-h" | _ => { print_usage(); }, } } else { - eprintln!(""); + println!("Invalid usage"); + print_usage(); + std::process::exit(1); } } -- cgit v1.2.3