diff options
| author | historia <gravel.justness270@slmail.me> | 2024-08-06 03:23:06 -0400 |
|---|---|---|
| committer | historia <gravel.justness270@slmail.me> | 2024-08-06 03:23:06 -0400 |
| commit | 0139b8b7896f6fcc89b3e2481d315e96af82ec4a (patch) | |
| tree | 5c22b4802e20f01db8c49e1ac2d914ba51135d4f | |
| parent | 0a87208f4cad82cfe7dd33c7fbcbcd7cc0d1e219 (diff) | |
| download | soon-0139b8b7896f6fcc89b3e2481d315e96af82ec4a.tar.gz | |
Added config file
| -rw-r--r-- | README.md | 42 | ||||
| -rw-r--r-- | src/then.nim | 25 |
2 files changed, 33 insertions, 34 deletions
@@ -1,15 +1,14 @@ # Then -Then is a minimalist, plain text, CLI calendar inspired by [When](https://www.lightandmatter.com/when/when.html). It has simple, concise syntax but supports recurring cases more complex than most calendars. +Then is a minimalist, text file based, CLI calendar inspired by [When](https://www.lightandmatter.com/when/when.html). It has simple, concise syntax but supports recurring cases more complex than most calendars. -- Schedule events directly in your editor +- Schedule events in a text file - Concise syntax for recurring cases and date ranges -- Group, sort, comment, and columnize events to keep text files neat +- Group, sort, comment, and columnize events to keep files neat - Add multiple lines of details to events - Archive events to remove them from your schedule (e.g. paid bill) - Keep events on calendar until dismissed (e.g. missed oil change) - Todo list with upcoming deadlines -- One binary, no dependencies - Fun In terms of features and complexity, Then lies between [When](https://www.lightandmatter.com/when/when.html) and [Remind](https://dianne.skoll.ca/projects/remind/) but aims to be less verbose than either. @@ -48,7 +47,7 @@ Tue, Taco night (Every Tuesday) # Logic and Date Ranges -Mon Wed Fri, Submit TPS Report (Every Mon, Wed, or Fri) +Mon Wed Fri, Submit TPS Report (Every Mon, Wed, or Fri) Fri !13, Every Friday except the 13th July 7-13 2024, Shark Week (Jun 25 2025)-(Jul 4 2025), Japan Trip @@ -165,27 +164,43 @@ Julian date modulus is definitely weird, but it's a concise way to express multi ### Footnote for astronomers and time nerds -The actual MJD is based on UTC, so this number is technically a *rounded*, modified Julian Day because it counts days since 1858-11-17 in your local time zone. This doesn't matter in practice. It's just a number that goes up by 1 every day. +The actual MJD is based on UTC, so Then technically uses a *rounded*, modified Julian Day because it counts days since 1858-11-17 in your local time zone. This doesn't matter in practice. It's just a number that goes up by 1 every day. Then's MJD is off by 1 from When. When starts counting from JD 1 while Then more correctly starts counting from JD 0. +# Archive File + +You can archive events in interactive mode with `then i`. This lets you archive an event like "Pay rent" early so you know it's done. + +- For recurring events with no end date, only the individual instance is archived. +- For events with one date, the event is removed from your calendar file. +- For events with an end date, it will only be removed from your calendar file if all occurences are archived. + +`showPastArchivedEvents` and `showFutureArchivedEvents` determine if archived events are hidden from your agenda entirely or show up as (Archived). + +## Keep events on calendar until manually archived + +In then.config, set `alwaysShowUnarchivedEvents=true` and old events will stick on your calendar until archived (regardless of the `past` setting). This means you will have to manually acknowledge every event. + +Then checks for events starting from `startDate` so you don't get recurring events showing up from the 1970s. + # Why would I use this? -Then was created as alternative to When with nicer syntax and todo features. It's for a small niche of people who not only want a terminal calendar, but want to edit their schedule directly in a text file rather than use a TUI. This small group almost exclusively uses [Remind](https://dianne.skoll.ca/projects/remind/). +Then was created as alternative to [When](https://www.lightandmatter.com/when/when.html) with nicer syntax and todo features. It's for a small niche of people who mainly edit their schedule directly in a text file rather than a TUI. This group almost exclusively uses [Remind](https://dianne.skoll.ca/projects/remind/) or [Org Mode](https://orgmode.org). Then has a few benefits over similar text file calendars: -1. Then has the most concise syntax. It minimizes special characters and simplifies ranges. Remind is arguably nicer for complex recurring cases and supports more types of conditions, but I rarely need those: +1. Then has the most concise syntax. It minimizes special characters and simplifies ranges. **Then**: `Jul 1-7 2025, Vacation!`\ **When**: `m=Jul & d>=1 & d<=7 & y=2025, Vacation!`\ **Remind**: `REM Jul 1 2025 THROUGH Jul 7 2025 MSG Vacation!` -2. Then *optionally* can use an archive file to manually "complete" events like todos +2. Then can use an archive file to manually "complete" events like todos Take the event "Change air filter", scheduled every 6 months. I might see that upcoming and archive that instance a week early to remove it from my calendar. Or I might let it slide until next weekend, in which case it sticks around until it's manually archived. -3. Then *optionally* shows a todo list and upcoming deadlines. +3. Then can shows a todo list and upcoming deadlines. # Alternatives @@ -194,12 +209,12 @@ If you're interested in other text file calendars, I highly recommend When or Re - [When](https://www.lightandmatter.com/when/when.html) - The simplest text file calendar that's flexible enough for real world use. - [Remind](https://dianne.skoll.ca/projects/remind/) - The most powerful, programmable calendar program ever made (CLI or otherwise) but simple cases are still concise. - [Better overview here.](https://blog.thechases.com/posts/remind/) -- [Org Mode](https://orgmode.org) - An expansive productivity playground for text with agenda features, but also a time sink trap for tinkerers. +- [Org Mode](https://orgmode.org) - Expansive text productivity system, but a time sink trap for tinkerers. ## See Also - [khal](https://github.com/pimutils/khal) - Similar CLI calendar, but stores calendars directly as .ics files. -- [calcure](https://github.com/anufrievroman/calcure) - The premier TUI calendar +- [calcure](https://github.com/anufrievroman/calcure) - The premier TUI calendar? - [Calcurse](https://calcurse.org/) - The other big TUI calendar - [Taskwarrior](https://taskwarrior.org/) - CLI todo thing with scheduling features - [calendar.vim](https://github.com/itchyny/calendar.vim) - Vim plugin @@ -215,7 +230,8 @@ If you're interested in other text file calendars, I highly recommend When or Re - Calendar output - Color - Julian modulus calculator (`then -j Jun 5 2025` > Outputs J and a table of common mod offsets) -- Android app +- CalDAV/.ics export? - Numerous CLI programs store calendars with .ics files directly, so it doesn't make much sense to use Then if you need to sync to a "main" calendar. +- Import? # License diff --git a/src/then.nim b/src/then.nim index cfd0b44..4f4199d 100644 --- a/src/then.nim +++ b/src/then.nim @@ -1,5 +1,5 @@ -import std/[times, os, strutils, strbasics, strscans, sets, tables], parseopt -import then/[conditions,typechecker] +import std/[times, os, strutils, strbasics, strscans, sets, strtabs, tables], parseopt +import then/[conditions, config, typechecker] const VERSION = "0.1" const configDir = expandTilde("~/.config/then/") @@ -9,25 +9,6 @@ const defaultCalendarFile = configDir & "calendar.then" const MONTHS = DefaultLocale.MMM.toHashSet + DefaultLocale.MMMM.toHashSet const WEEKDAYS = DefaultLocale.ddd.toHashSet + DefaultLocale.dddd.toHashSet -# Creates a default configuration file if it doesn't exist -proc createDefaultConfigFile() = - if not fileExists(defaultConfigFile): - if not dirExists(configDir): - createDir(configDir) - writeFile(defaultConfigFile, """ - [config] - directory = "~/.config/then/" - """) - -# Creates a default calendar file if it doesn't exist -proc createDefaultCalendarFile() = - if not fileExists(defaultCalendarFile): - if not dirExists(configDir): - createDir(configDir) - writeFile(defaultCalendarFile, """ - # Add your events here - """) - proc printHelp(badCmd: string) = if badCmd != "": echo badCmd & " is not a valid option\n" @@ -130,6 +111,8 @@ proc printCalendar() = printEvents(cal, curDay, "ddd yyyy MMM dd") proc main() = + var config = loadConfig() + echo config var past: int = 1 var future: int = 14 var noArg: bool = true |
