diff options
| author | Historia <gravel.justness270@slmail.me> | 2024-06-25 17:38:45 -0400 |
|---|---|---|
| committer | Historia <gravel.justness270@slmail.me> | 2024-06-25 17:38:45 -0400 |
| commit | b88e9c139d442e0b3f15551ce31f09fc7478f3b2 (patch) | |
| tree | fd4ab2390fa167bbf33cae3c0280b2f0e7797ef1 | |
| parent | f6275ce382b534e842491d7cec2a3ffbb94bfe1f (diff) | |
| download | soon-b88e9c139d442e0b3f15551ce31f09fc7478f3b2.tar.gz | |
Initial commit
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | LICENSE | 2 | ||||
| -rw-r--r-- | LICENSE-3RD-PARTY | 12 | ||||
| -rw-r--r-- | README.md | 109 | ||||
| -rw-r--r-- | src/then.nim | 1 | ||||
| -rw-r--r-- | tests/testthen.nim | 4 | ||||
| -rw-r--r-- | then.nimble | 13 |
7 files changed, 140 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8da1d4b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +then @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Historia +Copyright (c) 2024 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/LICENSE-3RD-PARTY b/LICENSE-3RD-PARTY new file mode 100644 index 0000000..f58af25 --- /dev/null +++ b/LICENSE-3RD-PARTY @@ -0,0 +1,12 @@ +PCRE is a library of functions to support regular expressions whose syntax and semantics are as close as possible to those of the Perl 5 language. + +Written by Philip Hazel +Copyright (c) 1997-2005 University of Cambridge + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + Neither the name of the University of Cambridge nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -1,3 +1,110 @@ # then -Minimalist, single text file calendar inspired by 'when'
\ No newline at end of file +then is a plain text calendar program inspired by [When](https://www.lightandmatter.com/when/when.html). + +## Goals +- Recurring events + +## Non-goals +- One line per event/day (might change this to how Remind works?) +- Nearest-weekday dates (e.g. the 'c' variable in `when`) +- Conditional recurrence like "Garbage day is every Tuesday except on Holidays" (I suggest [Remind](https://dianne.skoll.ca/projects/remind/) for this) + +# `.then` file syntax + +``` +# COMMENT +DATE, EVENT +- DETAILS +``` + +- Lines beginning with `#` are comments used to annotate or group events together. +- Lines beginning with `-` are additional details attached to the above event. +- Blank lines are ignored. +- Otherwise, a line is an event. Everything before the first comma is interpreted as the date. +- Parameters in the date can be written in any order, whitespace delimited: + +1. 4 digts is the year +2. A month can be written as a full word (January) or 3-character abbreviation (Jan) +3. Days can be full words or common abbreviations (R, Th, Thu, Thur, or Thurs, or Thursday are all acceptable) +4. NN:NN is the time. An end time can be given too as NN:NN-NN:NN with no space. +5. Nw is the Nth set of 7 days in a month, e.g. `2w`. +6. Nlw is the Nth-from-last set of 7 days in a month, e.g. `2lw` + +``` +# Simple Examples + +2025 Jan 1 00:00-03:00, Work party +2025 Jan 1 04:00, Go to bed +Jan 1, New Year's Day (Jan 1 every year) +1, Mortgage due (1st of every month) + + +# `w` and `lw` parameters + +May 2w Sun, Mother's Day (Second Sunday of May) +May 1lw Mon, Memorial Day (Last Monday of May) + + +# Logical Operators (`|` or, `!` not, `and` is implied by whitespace) + +1 | 15, 1st OR 15th of month +Fri !(Dec 25), Every Friday, NOT December 25 +1 2, 1st AND 2nd (i.e. never) + +# Modified Julian Date Logic (`j` and `%`) +# We have to work on the syntax + +!(j%14-5), Every other Saturday + + +# Details (Any lines prepended with - are attached to the above event) + +2025 Jan 5 16:00, Doctor's Appointment +- 123 Gentoo Road, San Francisco, CA 12345 +- Dr. Elias Berkins, +1 (555)-123-1234 +``` + +Lines prefixed with `#` are comments and can be used to organize events into groups. When sorting events, all events under a comment will stay under that same comment. + + +# Why would I use this? + +Calendars are some of the most integrated (yet privacy invasive) productivity applications. If you use Outlook or Google Calendar to share meetings and availability across a team or family, an offline, DIY-synced, text file with arcane syntax is not a suitable replacement. + +For my personal calendar I used to use [Proton Calendar](https://proton.me/calendar), which by design is a hassle to share/export/automate. Rather than try to wrangle a third party calendar, I'm reinventing the wheel. + +## Why would I use this *over When*? + +I really like When (the Perl program) and then is objectively less powerful because it omits variables I never use. This let's me express days in a simpler syntax. + +1. Parameter types are inferred. The only 4-digit `%d%d%d%d` string that can appear in a date is the year. `y=1984` in `when` is simplified to `1984` in `then`. This is possible by omiting the `e` (Easter), `z` (Day of year), and `c` (Nearest weekday) variables, and changing `a=1` and `b=2` to `1W` and `2LW`. +2. The `&` logical operator is implied by whitespace. `m=jan & d=1` in `when` is simplified to `Jan 1` in `then`. + +In short, I think it looks nicer: + +when: `m=dec & d=25, Christmas` or `* Dec 25, Christmas` +then: `Dec 25, Christmas` + +when: `m=sep & w=mon & a=1, Labor Day` +then: `Sep Mon 1W, Labor Day` + + +# Alternatives + +If you're interested in text file based calendars, the three GOATs are: + +- [When](https://www.lightandmatter.com/when/when.html) - IMO, the simplest terminal calendar that's flexible enough for real world use. +- [Remind](https://dianne.skoll.ca/projects/remind/) - A **VERY** flexible, programmable calendar format. I can't imagine a scheduling case you couldn't cover. [(Better overview here.)](https://blog.thechases.com/posts/remind/) +- [Org Mode](https://orgmode.org) - The most flexible and expansive productivity playground for text (warning: endless time sink). + +## See Also + +- [Emacs Diary](https://www.gnu.org/software/emacs/manual/html_node/emacs/Format-of-Diary-File.html) - A single agenda/diary file. +- [Plain Text Personal Organizer](https://danlucraft.com/blog/2008/04/plain-text-organizer/) +- [Calendar.txt](https://terokarvinen.com/2021/calendar-txt/) - A one-day per line text calendar format inspired by [todo.txt](https://todotxt.org/). Very simple but high maintenence due to lack of repeating events, etc. +- Featureful TUI calendar/productivity apps like [Calcurse](https://calcurse.org/), [calcure](https://github.com/anufrievroman/calcure), [khal](https://github.com/pimutils/khal), and maybe [Taskwarrior](https://taskwarrior.org/). Often it's preferable to manage appointments via the program itself rather than directly editing a text file. + +# License + +MIT diff --git a/src/then.nim b/src/then.nim new file mode 100644 index 0000000..b346329 --- /dev/null +++ b/src/then.nim @@ -0,0 +1 @@ +echo "Hello world. Thanks for checking the first commit." diff --git a/tests/testthen.nim b/tests/testthen.nim new file mode 100644 index 0000000..8e87cdd --- /dev/null +++ b/tests/testthen.nim @@ -0,0 +1,4 @@ +import ../src/then + +doAssert true +doAssert 1 == 1 diff --git a/then.nimble b/then.nimble new file mode 100644 index 0000000..6ba408c --- /dev/null +++ b/then.nimble @@ -0,0 +1,13 @@ +# Package + +version = "0.1.0" +author = "Historia" +description = "Minimalist, single text file calendar inspired by when" +license = "MIT" +srcDir = "src" +bin = @["then"] + + +# Dependencies + +requires "nim >= 2.0.4" |
