timewarrior/ext/csv.py
Thomas Lauf dc77a8c457 Use new style formatting
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-28 18:39:18 +01:00

26 lines
479 B
Python
Executable file

#!/usr/bin/env python
import sys
import json
# Skip the configuration settings.
for line in sys.stdin:
if line == '\n':
break
# Extract the JSON.
doc = ''
for line in sys.stdin:
doc += line
total_active_time = 0
j = json.loads(doc)
for object in j:
line = '"{}","{}"'.format(object['start'], (object['end'] if 'end' in object else ''))
if 'tags' in object:
for tag in object['tags']:
line += ',"{}"'.format(tag)
print(line)