Add a -n/--now flag to only print the current hour’s name

This commit is contained in:
2022-05-24 17:14:51 +02:00
parent ccaa902be8
commit b63d4cbac8
2 changed files with 20 additions and 2 deletions

View File

@@ -11,17 +11,27 @@ mod clock;
mod config;
mod svg_clock;
use clock::get_current_hour_name;
use config::{get_config, Config};
use svg_clock::{cache_hour_name_paths, gen_svg, svg_to_usvg};
#[derive(Parser, Debug)]
#[clap(author, version, about, long_about = None)]
struct Args {}
struct Args {
/// Print the current hours name and exit
#[clap(short, long)]
now: bool,
}
sctk::default_environment!(SeasonalClock, desktop);
fn main() {
Args::parse();
let args = Args::parse();
if args.now {
println!("{}", get_current_hour_name());
std::process::exit(0);
}
let config = get_config();
run_windowed(&config);