summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2017-09-24 08:07:09 +0200
committerGitHub <noreply@github.com>2017-09-24 08:07:09 +0200
commit453dc0bfb484841d3aebb0d5c607b79eb3130133 (patch)
tree29dd3509e457bdc6903cbf5397bfa68d7e41ef48
parentccfdd7315797a99f82a7c616c42c9313b2e556c6 (diff)
parent9576705786d2d27c10669549c7081a4782ce090d (diff)
downloadcalendar-cli-453dc0bfb484841d3aebb0d5c607b79eb3130133.zip
Merge pull request #35 from fauxmight/master
whole-day fix and minor typos
-rw-r--r--README.md22
-rwxr-xr-xcalendar-cli.py6
2 files changed, 21 insertions, 7 deletions
diff --git a/README.md b/README.md
index da9aa10..d7b590d 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ Rationale
GUIs and Web-UIs are nice for some purposes, but I really find the command line unbeatable when it comes to:
-* Minor stuff that are repeated often. Writing something like "todo add make a calendar-cli system" or "cal add 'tomorrow 15:40+2h' doctor appointment" is just very much faster than navigating into some web calendar interface and add an item there.
+* Minor stuff that are repeated often. Writing something like "todo add make a calendar-cli system" or "calendar add 'tomorrow 15:40+2h' doctor appointment" is just very much faster than navigating into some web calendar interface and add an item there.
* Things that are outside the scope of the UI. Here is one of many tasks I'd like to do: "go through the work calendar, find all new calendar events that are outside office hours, check up with the personal calendar if there are potential conflicts, add some information at the personal calendar if appropriate", and vice versa - it has to be handled very manually if doing it through any normal calendar application as far as I know, but if having some simple CLI or python library I could easily make some interactive script that would help me doing the operation above.
I've been looking a bit around, all I could find was cadaver and 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.
@@ -46,7 +46,7 @@ not be up-to-date and may contain features not implemented yet.
* --interactive: stop and query the user rather often
* --caldav-url, --caldav-user, --caldav-pass: how to connect to the CalDAV server. Fits better into a configuration file.
* --calendar-url: url to the calendar one wants to use.
-* --config-file: use a specific configuration file (default: $HOME/.calendar-cli.conf)
+* --config-file: use a specific configuration file (default: $HOME/.config/calendar.conf)
* --config-section: use a specific section from the config file (i.e. to select a different caldav-server to connect to)
* --icalendar: Write or read icalendar to/from stdout/stdin
* --nocaldav: don't connect to a caldav server
@@ -87,13 +87,27 @@ Configuration file is by default located in $HOME/.config/calendar.conf and shou
The file may look like this:
```json
-{ "default":
- { "caldav_url": "http://foo.bar.example.com/caldav/",
+{ "default":
+ { "caldav_url": "http://foo.bar.example.com/caldav/",
"caldav_user": "luser",
"caldav_pass": "insecure"
}
}
```
+A configuration with multiple sections may look like this:
+
+```json
+{ "default":
+ { "caldav_url": "http://foo.bar.example.com/caldav/",
+ "caldav_user": "luser",
+ "caldav_pass": "insecure"
+ },
+ "caldav_url": "http://foo.baz.example.com/caldav/",
+ "caldav_user": "luser2",
+ "caldav_pass": "insecure2"
+ }
+}
+```
Optionally, in addition (or even instead) of "default", other "sections" can be created and selected through the --config-section option. The rationale is to allow configuration for multiple CalDAV-servers, or multiple calendars on the same CalDAV-server to remain in the same configuration file. Later versions will eventually be capable of copying events, or putting events into several calendars.
diff --git a/calendar-cli.py b/calendar-cli.py
index 7edd613..2d2ed3e 100755
--- a/calendar-cli.py
+++ b/calendar-cli.py
@@ -292,8 +292,8 @@ def calendar_add(caldav_conn, args):
duration = int(event_spec[1][:-1])
dtstart = dateutil.parser.parse(event_spec[0])
dtend = dtstart + timedelta(days=duration)
- event.add('dtstart', _date(dtstart.date))
- event.add('dtend', _date(dtend.date))
+ event.add('dtstart', _date(dtstart.date()))
+ event.add('dtend', _date(dtend.date()))
else:
event.add('dtstart', dtstart)
## TODO: handle duration and end-time as options. default 3600s by now.
@@ -818,7 +818,7 @@ def main():
## journal
journal_parser = subparsers.add_parser('journal')
- journal_subparsers = journal_parser.add_subparsers(title='tasks subcommand')
+ journal_subparsers = journal_parser.add_subparsers(title='journal subcommand')
journal_add_parser = journal_subparsers.add_parser('add')
journal_add_parser.add_argument('summaryline', nargs='+')
journal_add_parser.set_defaults(func=journal_add)