caldr
, the command line calendar. It's super lightweight, yet it
supports CardDAV sync!
go build .
Either export all necessary variables to your ENV or set them as command line flags:
export CARDDAV_USERNAME='...'
export CARDDAV_PASSWORD='...'
export CARDDAV_ENDPOINT='...'
export CALDR_DB='...'
If you're using Baïkal for example, you
would export something like this as CARDDAV_ENDPOINT
:
export CARDDAV_ENDPOINT='https://my.baik.al/dav.php/'
The CALDR_DB
is the local events database in order to not need to contact
the CalDAV for every lookup. You might set it to something like this:
export CALDR_DB=~/.cache/caldr.db
When caldr
is launched for the first time, it requires the -r
flag to
refresh the events and sync them locally:
caldr -r
This way you could create a cron job that refreshes caldr
in the background,
e.g. every three hours:
crontab -e
0 */3 * * * sh -c 'caldr -r'
You can also output contacts as JSON format using the -j
flag:
caldr -j
Find more flags and info with caldr --help
.
You can customize the regular output using templating. The template can either
be passed using the --template <file>
flag or by exporting CALDR_TEMPLATE
in the in the environment.
The templating format is the Go standard text/template
format.
Available property names that are available can be found by checking the
CalEvent
struct in store/store.go
.
An example template can be found here. To make use of the template, you can
copy it to e.g. ~/.config/caldr.tmpl
and have
CALDR_TEMPLATE=~/.config/caldr.tmpl
exported in your .zshrc
/.bashrc
/etc.
Check my dotfiles, especially this script for how to get notifications for events. You could either run this script on login or periodically as a cron job.
- Q: Does
caldr
write/modify any contact information? A: Nope, so far it's read-only and does not support updating iCals, hence it won't mess with your data. - Q: Can I use it with my local calendar?
A: Nope, as of right now
caldr
only supports CalDAV servers to sync with. - Q: Does it support HTTP Digest auth? A: Nope, only HTTP Basic auth.
- Q: The
text/template
stuff doesn't work for me, can I makecaldr
output contact data differently? A: Yes, you can use the-j
flag and have it output pure JSON, which you can then process using e.g.jq
.