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 --- src/main.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/main.rs') 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