tobixen / plann

Command-line interface to calendars
GNU General Public License v3.0
44 stars 2 forks source link

plann

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

This is the experimental new version of my old calendar-cli project.

Perhaps this work is moot ... or perhaps just 20 years too late. Considering the recent progress of chatbots, probably soon all calendar queries can be done in natural language.

Other tools

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 plann and calendar-cli is slightly different, it is supposed to be a simple cli-based caldav+ical client. No synchronization, no local storage, just client-side operations.

New vs old interface

Based on user feedback I decided to fork calendar-cli into plann. calendar-cli is the old, mature, production-ready, stable API interface, it will hang around and be supported for some time to come. plann is the new interface, but until version 1.0 is ready, there will still be functionality in calendar-cli that isn't mirrored to cal.py.

Usage examples

The commands and options will be described further down, however examples often beat documentation. There is one example directory with some usage examples, and eventually I will also try to write up some test code that can serve as examples.

Installation

plann depends on several python libraries, e.g. icalendar, caldav, etc.

Virtual Environment Install

This installs plann and all its dependencies in the virtual environment you create. To run it, you have to activate this virtual environment in your current shell.

  1. Clone this repo, cd to plann
  2. python3 -m venv .venv
  3. source .venv/bin/activate (See venv documentation)
  4. python3 setup.py install

Systemwide Install

This installs plann and all its dependencies system-wide.

  1. Clone this repo, cd to plann
  2. sudo ./setup.py install

Support

#calendar-cli at irc.oftc.net (I'm not available 24/7 there), eventually t-plann@tobixen.no, eventually the issue tracker at https://github.com/tobixen/plann/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. If you're using the master branch of plann, you should also be using the master branch 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, the predecessor to plann, 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

plann [global options] [command] [command options] [subcommand] [subcommand options] [subcommand arguments] ...

I'm intending to make it easier by allowing plann 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 should 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

The list may not be complete. --help should give a more complete overview.

Event time specification

Supported since calendar_cli (predecessor to plann) v0.12:

All of those would eventually be supported in future versions if it's not too difficult to achieve:

Alternatively, endtime or duration can be given through options

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

This is a string containing variables enclosed in curly braces, like "uid: {uid}". Full documentation of the available variables will be given in version 1.0.

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. plann supports both json and yaml.

(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 plann.conf)

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"
  }

Example:

---
work-calendar:
  caldav_url: "http://acme.example.com/caldav/"
  caldav_user: drjekyll
  caldav_pass: pencilin
  calendar_url: mycalendar
work-appointments:
  inherits: work-calendar
  calendar_url: mypatients
private-calendar:
  caldav_url: "https://ecloud.global/remote.php/dav/"
  caldav_user: mrhyde
  caldav_pass: hunter2
  calendar_name: goodgames
brothel-appointments:
  inherits: private-calendar
  calendar_name: badgames
work:
  contains: [ 'work-calendar', 'work-appointments' ]
private:
  contains: [ 'private-calendar', 'brothel-appointments' ]

Usage example

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

./plann --calendar-url=http://calendar.bekkenstenveien53c.oslo.no/caldav.php/tobias/calendar/ --caldav-server=http://calendar.bekkenstenveien53c.oslo.no/caldav.php --caldav-user=myusername --caldav-pass=mypassphrase add event testevent 2013-10-01

Add a todo item "change oil":

./plann --calendar-url=http://calendar.bekkenstenveien53c.oslo.no/caldav.php/tobias/calendar/ --caldav-server=http://calendar.bekkenstenveien53c.oslo.no/caldav.php --caldav-user=myusername --caldav-pass=mypassphrase add todo "change oil"

See USAGE.MD for further instructions on how to use plann.

Objectives

Roadmap

See NEXT_LEVEL.md and NEW_CLI.md for the direction the project is heading.