diff options
Diffstat (limited to '')
| -rw-r--r-- | README.md | 95 |
1 files changed, 94 insertions, 1 deletions
| @@ -1,2 +1,95 @@ | |||
| 1 | # sdep | 1 | # sdep |
| 2 | A simple "date+event" line parser | 2 | A simple "date+event" line parser. |
| 3 | |||
| 4 | sdep follows the UNIX philosphy (do one thing well, use stdin and stdout) and | ||
| 5 | is heavily inspired by [suckless](https://suckless.org) utilities such as | ||
| 6 | [dmenu](https://tools.suckless.org/dmenu/). | ||
| 7 | |||
| 8 | You can wrap it around shell scripts to turn it into a no-nonsense calendar | ||
| 9 | system. | ||
| 10 | |||
| 11 | ## Description | ||
| 12 | |||
| 13 | sdep reads lines of the form `date text` from stdin and writes to stdout those | ||
| 14 | lines such that `date` is between the two dates specified by the `-f` and `-t` | ||
| 15 | options, both of which default to the current minute. | ||
| 16 | |||
| 17 | The dates should correspond to a unique minute in time. The format for `date` | ||
| 18 | can be specified with the same syntax as for date(1). | ||
| 19 | |||
| 20 | ## Installation | ||
| 21 | Edit the Makefile to match your local configuration and type `make install`. | ||
| 22 | |||
| 23 | ## Examples | ||
| 24 | If `events.txt` contains lines formatted as `date text` then | ||
| 25 | |||
| 26 | ``` | ||
| 27 | sdep <events.txt | ||
| 28 | ``` | ||
| 29 | |||
| 30 | will print all lines whose date match the current minute. Instead | ||
| 31 | |||
| 32 | ``` | ||
| 33 | sdep -f <events.txt | ||
| 34 | ``` | ||
| 35 | |||
| 36 | will print all the lines whose date is in the past, while | ||
| 37 | |||
| 38 | ``` | ||
| 39 | sdep -t -w "%A" <events.txt | ||
| 40 | ``` | ||
| 41 | |||
| 42 | will print all lines whose date is in the future, showing only the day of the | ||
| 43 | week and the text. | ||
| 44 | |||
| 45 | ``` | ||
| 46 | sdep -f "1999-01-01 00:00" -t "1999-12-31 23:59" -w "" <events.txt | ||
| 47 | ``` | ||
| 48 | |||
| 49 | will show only the `text` of all lines with a date in 1999. You can specify a | ||
| 50 | different format for the dates, for example | ||
| 51 | |||
| 52 | ``` | ||
| 53 | sdep +"%m/%d/%Y %I:%M%p" -t "12/31/2020 11:59pm" -w "" <events.txt | ||
| 54 | ``` | ||
| 55 | |||
| 56 | will match all dates from December 31st, 2020, one minute before midnight | ||
| 57 | (included). Note: this only works if your locale has an am/pm format, see | ||
| 58 | date(1). | ||
| 59 | |||
| 60 | ## A stupidly simple calendar app | ||
| 61 | If you keep your events and reminders in a simple plain text file (say | ||
| 62 | events.txt), you can run | ||
| 63 | |||
| 64 | ``` | ||
| 65 | sdep -w "" -s "" | while read text; do notify-send "$text"; done < events.txt | ||
| 66 | ``` | ||
| 67 | |||
| 68 | every minute, for example using cron(8), to get a notification every time | ||
| 69 | an events is happens. | ||
| 70 | |||
| 71 | You can use `sdep -f -t < events.txt` to list all your events, or | ||
| 72 | `sdep -t < events.txt` to list only the future ones. You can specify any date | ||
| 73 | range. Running | ||
| 74 | |||
| 75 | ``` | ||
| 76 | temp = $(mktemp) | ||
| 77 | sdep -t <events.txt >"$temp" | ||
| 78 | mv "$temp" events.txt | ||
| 79 | ``` | ||
| 80 | |||
| 81 | will remove all old events from your file. | ||
| 82 | |||
| 83 | You can edit your events using any text editor and you can keep them synced | ||
| 84 | between multiple devices using something like | ||
| 85 | [rsync](https://rsync.samba.org/). | ||
| 86 | |||
| 87 | ## Scripts | ||
| 88 | The `scripts` folder contains the few scripts that I use. They are basically | ||
| 89 | just a slightly more elaborate version of the calendar system described above, | ||
| 90 | with support for recurring events (e.g. weekly, daily). You can install them | ||
| 91 | with `make scripts`, but first make sure to adjust them to match your local | ||
| 92 | configuration, like the location of the events file. | ||
| 93 | |||
| 94 | Most of the script rely on the `-d` option of the GNU date utility, so you | ||
| 95 | should change that too if you are on a BSD system or on MacOS. | ||
