diff options
| -rw-r--r-- | README.md | 12 | ||||
| -rw-r--r-- | src/then.nim | 6 |
2 files changed, 14 insertions, 4 deletions
@@ -159,9 +159,9 @@ Julian date modulus is definitely weird, but it's a concise way to express multi Then was created to adapt existing CLI calendars to my personal workflow. Then is not only for the niche of people who use their terminal for scheduling, but for a sub-niche who prefer to edit a file over using a TUI which is why concise, legible syntax is so important. This is a very small group of people who virtually exclusively use [Remind](https://dianne.skoll.ca/projects/remind/). If you're happy with a web or phone calendar, Then probably won't change your mind. -Then has a few benefits over similar text file calendars: +## Then has concise syntax compared to similar programs -1. Then has the most concise syntax. It minimizes special characters and simplifies ranges. +It minimizes special characters and simplifies ranges. **Then**: `1, Water bill`\ **When**: `* * 1, Water bill`\ @@ -177,9 +177,13 @@ Remind is wordier but nicer for recurring cases cases that require Julian dates, **When**: `m=jul & d>=10 & d<=19 & y=2024 & !(j%3-2)`\ **Remind**: `REM Jul 10 2025 *3 THROUGH Jul 19 2025` -2. It *optionally* has the ability to archive calendar events. Take the event "Change air filter", scheduled every 6 months. I might see that upcoming and archive this instance a week early, which removes it from my calendar. Or I might let it slide until next weekend, in which case it sticks around until it's done. +## Then *optionally* can archive calendar events. -3. It *optionally* shows a to-do list and upcoming deadlines. +Take the event "Change air filter", scheduled every 6 months. I might see that upcoming and archive this instance a week early, which removes it from my calendar. Or I might let it slide until next weekend, in which case it sticks around until it's done. + +I use many calendar events (bills, etc.) as a quasi-todo list, so I need to know when I've actually completed them, not just be reminded on a specific day. + +## It *optionally* shows a to-do list and upcoming deadlines. # Alternatives diff --git a/src/then.nim b/src/then.nim index 6137fdf..a74a863 100644 --- a/src/then.nim +++ b/src/then.nim @@ -96,6 +96,10 @@ proc checkDateGroup(s: string, date: DateTime): bool = return false return true +proc checkRangeYear(s: string, date: DateTime): bool = + var years = s.split('-') + return date.year >= years[0] and date.year <= years[1] + proc checkCond(cond: string, date: DateTime): bool = var condition = cond var invert = false @@ -126,6 +130,8 @@ proc checkCond(cond: string, date: DateTime): bool = found = true of "dategroup": found = checkDateGroup(condition, date) + of "rangeyear": + found = checkRangeYear(condition, date) of "unknown": echo "ERROR: Unknown condition: ", condition if invert == true: |
