@@ -20,10 +20,51 @@ struct Calendars: ParsableCommand {
2020 valueName: " f "
2121 ) ) var format : CalendarFormat = . json
2222
23+ @Option ( help: ArgumentHelp (
24+ " Select calendars <v>. A comma separated list of calendar UUIDs " ,
25+ valueName: " v "
26+ ) ) var selectCalendars : [ String ] = [ ]
27+
28+ @Option ( help: ArgumentHelp (
29+ " Ignore calendars <v>. A comma separated list of calendar UUIDs " ,
30+ valueName: " v "
31+ ) ) var ignoreCalendars : [ String ] = [ ]
32+
33+ @Option ( help: ArgumentHelp (
34+ " Select calendar sources <s>. A comma separated list of calendar sources " ,
35+ valueName: " s "
36+ ) ) var selectCalendarSources : [ String ] = [ ]
37+
38+ @Option ( help: ArgumentHelp (
39+ " Ignore calendar sources <s>. A comma separated list of calendar sources " ,
40+ valueName: " s "
41+ ) ) var ignoreCalendarSources : [ String ] = [ ]
42+
43+ @Option ( help: ArgumentHelp (
44+ " Select calendar types <v>. A comma separated list of calendar types. " +
45+ " Available: [local|caldav|exchange|subscription|birthday] " ,
46+ valueName: " v "
47+ ) ) var selectCalendarTypes : [ EKCalendarType ] = [ ]
48+
49+ @Option ( help: ArgumentHelp (
50+ " Ignore calendar types <v>. A comma separated list of calendar types. " +
51+ " Available: [local|caldav|exchange|subscription|birthday] " ,
52+ valueName: " v "
53+ ) ) var ignoreCalendarTypes : [ EKCalendarType ] = [ ]
54+
2355 mutating func run( ) {
2456 Log . setDebug ( debug)
2557
26- let calendars = EventStore ( ) . calendars ( )
58+ let calendarFilter = CalendarFilter . build (
59+ selectCalendars: selectCalendars,
60+ ignoreCalendars: ignoreCalendars,
61+ selectCalendarSources: selectCalendarSources,
62+ ignoreCalendarSources: ignoreCalendarSources,
63+ selectCalendarTypes: selectCalendarTypes,
64+ ignoreCalendarTypes: ignoreCalendarTypes
65+ )
66+
67+ let calendars = EventStore ( ) . calendars ( filter: calendarFilter)
2768
2869 switch format {
2970 case . json:
0 commit comments