‹ back home

Introducing davcli

2023-05-01 #open-source #status-update #vdirsyncer

I mentioned in the past that libdav (the library which I’ve written to interact with caldav and carddav servers) implements DNS-based discovery.

This should make any tools built on this library a lot easier to configure for end users. One such tool so far is davcli, a simple command line tool to interact with caldav servers manually or via simple scripts. It is also useful for hosting providers that want to validate that discovery is set up correctly. For example:

> DAVCLI_PASSWORD=XXX davcli caldav --server-url https://fastmail.com --username vdirsyncer@fastmail.com discover
Discovery successful.
- Context path: https://d277161.caldav.fastmail.com/dav/calendars
- Calendar home set: https://d277161.caldav.fastmail.com/dav/calendars/user/vdirsyncer@fastmail.com/

Aside from discovery itself, davcli can be used to list calendars, list components (events, todos, etc) inside calendars and fetch them. More operations (e.g.: uploading new items) are in scope, but will be addressed at a future time since the synchronisation aspect of vdirsyncer is a priority right now.

I’d appreciate hearing feedback from running davcli with it (especially if you find any valid cases where davcli fails).

Demo session

Here’s a demo session using davcli on a test account:

$ davcli --help
Usage: davcli [OPTIONS] <COMMAND>

Commands:
  caldav
          Operate on a CalDav server
  carddav
          Operate on a CardDav server
  help
          Print this message or the help of the given subcommand(s)

[... other options trimmed for breverity ...]
$ davcli caldav --help
Operate on a CalDav server

Usage: davcli caldav --server-url <SERVER_URL> --username <USERNAME> <COMMAND>

Commands:
  discover
          Perform discovery and print results
  find-calendars
          Find calendars under the calendar home set
  list-calendar-components
          List calendar components under a given calendar collection
  get
          Fetches a single calendar component
  help
          Print this message or the help of the given subcommand(s)

Options:
      --server-url <SERVER_URL>
          A base URL from which to discover the server.

          Examples: `http://localhost:8080`, `https://example.com`.

      --username <USERNAME>
          Username for authentication

  -h, --help
          Print help (see a summary with '-h')
$ davcli caldav discover --help
Perform discovery and print results

Usage: davcli caldav --server-url <SERVER_URL> --username <USERNAME> discover

Options:
  -h, --help  Print help
$ davcli caldav --server-url https://fastmail.com --username vdirsyncer@fastmail.com discover
Discovery successful.
- Context path: https://d277161.caldav.fastmail.com/dav/calendars
- Calendar home set: https://d277161.caldav.fastmail.com/dav/calendars/user/vdirsyncer@fastmail.com/
$ davcli caldav --server-url https://fastmail.com --username vdirsyncer@fastmail.com find-calendars
/dav/calendars/user/vdirsyncer@fastmail.com/w6SUMkhoSb8JD3qF/
/dav/calendars/user/vdirsyncer@fastmail.com/w9y5I6DKhBKIYLiB/
/dav/calendars/user/vdirsyncer@fastmail.com/wJj87C2IVgAdzyLm/
$ davcli caldav --server-url https://fastmail.com --username vdirsyncer@fastmail.com list-calendar-components /dav/calendars/user/vdirsyncer@fastmail.com/w6SUMkhoSb8JD3qF/
/dav/calendars/user/vdirsyncer@fastmail.com/w6SUMkhoSb8JD3qF/eppLJLoI6kNs.ics
/dav/calendars/user/vdirsyncer@fastmail.com/w6SUMkhoSb8JD3qF/qU2lNaMmAZVj.ics
$ davcli caldav --server-url https://fastmail.com --username vdirsyncer@fastmail.com get /dav/calendars/user/vdirsyncer@fastmail.com/w6SUMkhoSb8JD3qF/eppLJLoI6kNs.ics
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:elgeVuhUQzZn
DTSTAMP:19970610T172345Z
DTSTART:19970714T170000Z
SUMMARY:hello\, testing
END:VEVENT

Have comments or want to discuss this topic?
Send an email to ~whynothugo/public-inbox@lists.sr.ht (mailing list etiquette)

— § —