diff --git a/Cargo.lock b/Cargo.lock index 0768e79..c84fadb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -248,7 +248,7 @@ dependencies = [ [[package]] name = "rsclock" -version = "0.1.9" +version = "0.1.10" dependencies = [ "chrono", "termion", diff --git a/Cargo.toml b/Cargo.toml index a3f3670..788e785 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rsclock" -version = "0.1.9" +version = "0.1.10" authors = ["valebes"] edition = "2021" @@ -9,7 +9,7 @@ homepage = "https://github.com/valebes/rsClock" repository = "https://github.com/valebes/rsClock" keywords = ["clock", "terminal", "unixporn"] -category = ["command-line-utilities"] +categories = ["command-line-utilities"] readme = "README.md" diff --git a/README.md b/README.md index 0a21cfb..81bc155 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ unix@weeb:~$ usage : rsclock -c Center the clock -v Show rsClock version -h Display this message + -o Print once, then exit ``` Use "+" and "-" to change foreground color. diff --git a/src/main.rs b/src/main.rs index 9f78300..cf50815 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ */ -const VERSION: &str = "0.1.9"; +const VERSION: &str = "0.1.10"; const ONE: [[bool; 6]; 5] = [ [false, false, true, true, false, false], @@ -228,6 +228,7 @@ fn help(nm: &String) { println!(" -c Center the clock"); println!(" -v Show rsClock version"); println!(" -h Display this message"); + println!(" -o Print once, then exit"); process::exit(1); } @@ -286,6 +287,7 @@ fn main() { let mut date_only = false; let mut twelve_hour_block = false; let mut twelve_hour_line = false; + let mut only_once = false; /* Default position modifier */ let x_mod = 1; @@ -373,6 +375,9 @@ fn main() { if &args[i] == &"-D".to_string() { date_only = true; } + if &args[i] == &"-o".to_string() { + only_once = true; + } } /* Setting format */ @@ -466,6 +471,9 @@ fn main() { } stdout.flush().unwrap(); + if only_once { + break; + } /* Wait for the next cycle */ let mut exit = 0;