Home

Awesome

calendar-cli

Simple command-line CalDAV client, making it possible to add calendar events, browse an agenda and do task management using a caldav server.

THIS IS THE LEGACY VERSION. If you're already using calendar-cli and don't want to change anything, then keep using it. If you need a production-ready mature command-line utility for accessing your calendar, then this is the right tool ... as for now. I decided to change a bit on the user interface, rather than breaking backward compatibility I made a new command name plann. I would recommend visit https://github.com/tobixen/plann for the new version.

calendar-cli will be maintained primarily for backward compatibility. Pull-requests dealing with bugfixes or minor "missing" features will be considered - but for anyone in need of a command-line interface towards a CalDAV calendar server, the recommendation is to use plann instead.

Other tools

There is another project out there, "Command-line Interface for Google Calendar", previously located at pypi under the calendar-cli name. It has now been renamed to gcalendar-cli to avoid name conflict, and is available at https://pypi.python.org/pypi/gcalendar-cli/

There is a "competing" project at https://github.com/geier/khal - you may want to check it out - it's more mature but probably more complex. It's using a "vsyncdir" backend - if I've understood it correctly, that involves building a local copy of the calendar. The philosophy behind calendar-cli is slightly different, calendar-cli is supposed to be a simple cli-based caldav+ical client. No synchronization, no local storage, just client-side operations.

Usage examples

The commands and options will be described further down, however examples often beat documentation.

First, check the tests folder - the file tests.sh shows some basic usage examples. If you have radicale installed (sudo pip install radicale), you can try executing test_calendar-cli.sh in the test folder, it basically sets up a temporary radicale server and executes the tests.sh towards that server. If test_calendar-cli.sh breaks then please raise an issue on the github or try to reach out through other channels.

In the examples folder there is a script I was using on a regular basis for task management for a while.

Installation

calendar-cli depends on quite some python libraries, i.e. pytz, caldav, etc. "sudo ./setup.py install" should take care of all those eventually, and will also make an executable under /usr/bin

Support

#calendar-cli at irc.oftc.net, eventually t-calendar-cli@tobixen.no, eventually the issue tracker at https://github.com/tobixen/calendar-cli/issues

Before reaching out, please make sure all the dependencies are installed and that you've installed the latest version of the caldav python library.

Rationale

GUIs and Web-UIs are nice for some purposes, but I really find the command line unbeatable when it comes to:

When I started writing calendar-cli, all I could find was cadaver and the CalDAVClientLibrary. Both of those seems to be a bit shortcoming; they seem to miss the iCalendar parsing/generation, and there are things that simply cannot be done through those tools.

Synopsis

calendar-cli.py [global options] [command] [command options] [subcommand] [subcommand options] [subcommand arguments] ...

I'm intending to make it easier by allowing calendar-cli.py to be symlinked to the various commands and also to allow the options to be placed wherever.

Global options

Only long options will be available in the early versions; I don't want to pollute the short option space before the CLI is reasonably well-defined.

Always consult --help for up-to-date and complete listings of options. The list below will only contain the most important options and may not be up-to-date and may contain features not implemented yet.

The caldav URL is supposed to be something like i.e. http://some.davical.server/caldav.php/ - it is only supposed to relay the server location, not the user or calendar. Things will most likely work if you give http://some.davical.server/caldav.php/tobixen/work-calendar/ - but it will ignore the calendar part of it, and use first calendar it can find - which perhaps may be tobixen/family-calendar/. Use http://some.davical.server/caldav.php/ as the caldav URL, and /tobixen/family-calendar as the calendar-url.

Commands

As of 0.12, there are two or three distinct commands - calendar (for management of events) and todo (for task management), with quite different code paths. The third thing is journal ... but as far as I know, it's not much common to use caldav servers for keeping journals, the journal thing is not much tested nor much rich on features.

There will be code refactorings in v1.0, applying quite some of the logic in the task management to the calendar management.

todo addlist: for creating a new task list. Most caldav servers don't make any difference between a task list and a calendar. Zimbra is an exception. addlist hasn't been tested as of version 0.12, perhaps it works, perhaps not)

Event time specification

Supported in v0.12:

Getting out customized information through --todo-template and --event-template

This is a string containing variables enclosed in curly braces, like "uid: {uid}".

Particularly the uid can be useful, as one may want to use the uid for things like deleting events and postponing tasks.

In the examples folder there is a task management script which will use the --todo-template to create a new shell script for postponing all overdue tasks. This shell script can then be edited interactively and run.

Task management

With the todo-command, there are quite some options available (i.e. --categories, --limit, --todo-uid, etc) to select or filter tasks. Those are used by the commands list, edit, postpone, complete and delete. A typical use-case scenario is to first use the "list" command, tweak the filtering options to get a list containing the tasks one wants to operate with, and then use either edit, postpone, complete or delete.

The file TASK_MANAGEMENT.md contains some thoughts on how to organize tasks.

Configuration file

Configuration file is by default located in $HOME/.config/calendar.conf. You may run calendar-cli --interactive-config if you don't feel comfortable with hand-crafting configuration in json syntax, though this feature is not tested regularly.

(I considered .ini, but I was told that it's actually not a standard. I'd like any calendar application to be able to access the file, hence calendar.conf and not calendar-cli.conf)

calendar-cli

The file may look like this:

{ "default":
  { "caldav_url": "http://foo.bar.example.com/caldav/",
    "caldav_user": "luser",
    "caldav_pass": "insecure"
  }
}

A configuration with multiple sections may look like this:

{
"default":
  { "caldav_url": "http://foo.bar.example.com/caldav/",
    "caldav_user": "luser",
    "caldav_pass": "insecure"
  },
"baz":
  { "caldav_url": "http://foo.baz.example.com/caldav/",
    "caldav_user": "luser2",
    "caldav_pass": "insecure2"
  }
}

Sections may also include calendar urls or ids, and sections may inherit other sections:

{
"default":
  { "caldav_url": "http://foo.bar.example.com/caldav/",
    "caldav_user": "luser",
    "caldav_pass": "insecure"
  },
"baz":
  { "caldav_url": "http://foo.baz.example.com/caldav/",
    "caldav_user": "luser2",
    "caldav_pass": "insecure2"
  }
},
"bazimportant":
  { "inherits": "baz",
    "calendar_url": "important"
  }

Usage example

Add a calendar item "testevent" at 2013-10-01:

./calendar-cli.py --calendar-url=http://calendar.bekkenstenveien53c.oslo.no/caldav.php/tobias/calendar/ calendar add 2013-10-01 testevent

(assumes that caldav-url, caldav-pass and caldav-user has been added into configuration file. Those may also be added as command line options)

Objectives

Roadmap

calendar-cli will be maintained with bugfixes and security fixes, on requests from the community. The maintainer is no longer using calendar-cli.

A new project https://github.com/tobixen/plann with a new interface has been forked off.