jcal-unfucker/jcal-unfuck.jq

14 lines
661 B
Text
Raw Normal View History

2023-10-18 13:11:53 +02:00
#!/usr/bin/jq -rfc
.[2] # skipping calender header and accessing events
| map( # for each event:
{_type: .[0]} # adding ical type like 'vevent' as ._type property
+ (
.[1] # accessing jCal properties; [1] holds name of iCalendar component, i.e. `vevent`; [2] holds additional components
| map({key: .[0], value: .[3]}) | from_entries # transforming event array structure into object structure
# only tested with vevents. pick() isn't supported in jq on debian bookworm
# | pick(.dtstart, .dtend, .summary, .location, .description, .sequence, .["related-to"]) # allow list of properties
2023-10-18 13:11:53 +02:00
)
)
2023-10-18 13:11:53 +02:00
| sort_by(.dtstart|fromdate) # sorting by event start time