Crates.io | time-condition |
lib.rs | time-condition |
version | 0.1.0 |
source | src |
created_at | 2023-11-30 16:21:07.824766 |
updated_at | 2023-11-30 16:21:07.824766 |
description | Check whether the current time matches a condition passed via CLI args |
homepage | |
repository | |
max_upload_size | |
id | 1054280 |
size | 50,405 |
time-condition
time-condition
is a command line utility for checking whether the current
time matches a condition. It might be useful to narrow down cases in which a
certain action should be performed when running inside a cron job for example.
Use the package manager
cargo to
install time-condition
.
cargo install time-condition
# Returns a positive result when run on a Thursday in even iso weeks.
time-condition 'iso_week % 2 == 0 && week_day == 4'
# Same but for Sundays in odd iso weeks.
time-condition 'iso_week % 2 == 1 && week_day == 7'
The expression evaluation is powered by https://docs.rs/evalexpr/latest/evalexpr/, with a few additional time based variables exposed:
1..=12
).1..=53
).1..=31
).1..=7
).0..=23
).0..=60
).Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.