Created
June 14, 2016 23:19
-
-
Save geier/206c047c0651847064e97bcb38c51a5f to your computer and use it in GitHub Desktop.
example of creating new events with khal (hardcoded config file named test.conf)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import khal | |
from khal.settings import get_config | |
from khal.cli import build_collection | |
from khal.controllers import new_from_string | |
from datetime import date, timedelta | |
today = date.today() | |
config = get_config('test.conf') | |
collection = build_collection(config, None) | |
collection_name = 'home' | |
events = [ | |
('Tomorrow 20:00 23:00 Beer with Alice and Bob', 'home', None), | |
('Monday 19:15 21:00 Calendar Interest Group', 'home', 'monthly'), | |
('Tomorrow {} Boss out of office'.format(today + timedelta(days=4)), 'work', None), | |
('12:00 13:00 Boring Meeting', 'work', None), | |
('Wednesday 19:00 21:00 python user group', 'home', None), | |
('{} {} Holiday'.format(today + timedelta(days=10), today + timedelta(days=20)), 'work', None), | |
('{} Khaliday'.format(today + timedelta(days=12)), 'work', None), | |
('2016-5-4 14:00 16:00 Super boring meeting', 'work', 'weekly'), | |
] | |
for description, collection_name, repeat in events: | |
new_from_string(collection, collection_name, config, description.split(), repeat=repeat) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment