jcal-unfucker/jcal-unfuck.jq
2023-10-18 13:11:53 +02:00

10 lines
479 B
Text
Executable file

#!/usr/bin/jq -rfc
[
(
.[2][] # skipping calender header and accessing events
| [["_type", {}, "text", .[0]], .[1][]] # adding ical type like 'vevent' as ._type property
| [.[] | {"key": .[0], "value": .[3]}] | from_entries # transforming event array structure into object structure
| pick(._type, .dtstart, .dtend, .summary, .location, .description, .sequence, .["related-to"]) # allow list of properties
)
]
| sort_by(.dtstart|fromdate) # sorting by event start time