aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.com>2025-09-10 01:09:23 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.com>2025-09-10 01:09:23 +0530
commit1965a620ca76019983c4089088b939ba3f4b2b6b (patch)
tree9cb440e161d51a953269c1ddb6912d2748d27c9a /src/main.rs
parente4fce03ca9c043c8cc99d5f7e1657f1e2beeb662 (diff)
Added help messagev0.1.1
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs20
1 files changed, 18 insertions, 2 deletions
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<String> = 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!("<help message>"),
+ "-h" | _ => { print_usage(); },
}
} else {
- eprintln!("<help message>");
+ println!("Invalid usage");
+ print_usage();
+ std::process::exit(1);
}
}