aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: df36530fd86710592474ccdf9e02b4a7f4d2fff3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# sdep

A simple "date+event" line parser.

sdep follows the UNIX philosphy (do one thing well, use stdin and stdout)
and is heavily inspired by [suckless](https://suckless.org) utilities
such as [dmenu](https://tools.suckless.org/dmenu/).

You can wrap it around shell scripts to turn it into a no-nonsense
calendar system.

## Description

sdep reads lines of the form `date text` from stdin and writes to stdout
those lines such that `date` is between the two dates specified with the
`-f` and `-t` options, both of which default to the current minute.

The format for `date` can be specified with the same syntax as for
date(1).  The dates should correspond to a unique minute in time.

## Installation

1. Either clone the repository or download the latest release version
   from the `releases` folder (warning: the release archive does not
   contain the customization scripts).
2. Edit the Makefile to match your local configuration and type
   `make install`.

## Examples

If `events.txt` contains lines formatted as `date text` then

```
sdep <events.txt
```

will print all lines whose date match the current minute. Instead

```
sdep -f <events.txt
```

will print all the lines whose date is in the past, while

```
sdep -t -w "%A" <events.txt
```

will print all lines whose date is in the future, showing only the day
of the week and the text.

```
sdep -f "1999-01-01 00:00" -t "1999-12-31 23:59" -w "" <events.txt
```

will show only the `text` of all lines with a date in 1999. You can
specify a different format for the dates, for example

```
sdep +"%m/%d/%Y %I:%M%p" -t "12/31/2020 11:59pm" -w "" <events.txt
```

will match all dates from December 31st, 2020, one minute before midnight
(included). Note: this only works if your locale has an am/pm format,
see date(1).

## A stupidly simple calendar app

If you keep your events and reminders in a simple plain text file (say
events.txt), you can run

```
sdep -w "" -s "" | while read text; do notify-send "$text"; done < events.txt
```

every minute, for example using cron(8), to get a notification every
time an events is happens.

You can use `sdep -f -t < events.txt` to list all your events, or 
`sdep -t < events.txt`
to list only the future ones. You can specify any date range. Running

```
temp = $(mktemp)
sdep -t <events.txt >"$temp"
mv "$temp" events.txt
```

will remove all old events from your file.

You can edit your events using any text editor and you can
keep them synced between multiple devices using something like
[rsync](https://rsync.samba.org/).

## Scripts

The `scripts` folder contains the few scripts that I use. They are
basically just a more elaborate version of the calendar system described
above, with support for recurring events (e.g. weekly, daily). You
can install them with `sudo SD=/path/to/scripts/folder make scripts`,
where `SD` specifies the path where the directory where you want your
sdep files to be saved; for example it can be `/home/username/.sdep`.
For example check that the folder SDEPDATA in Makefile suits you.

Most of the scripts rely on the `-d` option of the GNU date utility,
so you should change that too if you are on a BSD system or on MacOS.

## Version history

| Version | Release date | Comment         |
|:--------|:-------------|:---------------:|
| 0.2     | 2023-05-23   | Minor fixes     |
| 0.1     | 2021-05-08   | Initial release |

Generated with cgit - Back to sebastiano.tronto.net