ics-query 0.1.1a0__tar.gz → 0.3.0b0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/.github/ISSUE_TEMPLATE/bug_report.md +2 -8
  2. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/PKG-INFO +194 -44
  3. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/README.md +188 -39
  4. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/__init__.py +3 -2
  5. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/_version.py +2 -2
  6. ics_query-0.3.0b0/ics_query/cli.py +643 -0
  7. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/parse.py +26 -4
  8. ics_query-0.3.0b0/ics_query/query.py +54 -0
  9. ics_query-0.3.0b0/ics_query/tests/runs/all --tz Singapore one-event.ics -.run +9 -0
  10. ics_query-0.3.0b0/ics_query/tests/runs/all three-events.ics -.run +33 -0
  11. ics_query-0.3.0b0/ics_query/tests/runs/at 2024-08-20 Berlin-Los-Angeles.ics -.run +23 -0
  12. ics_query-0.3.0b0/ics_query/tests/runs/between 20240823 4d recurring-work-events.ics -.run +24 -0
  13. ics_query-0.3.0b0/ics_query/tests/runs/calendars/Berlin-Los-Angeles.ics +381 -0
  14. ics_query-0.3.0b0/ics_query/tests/runs/calendars/empty-calendar.ics +7 -0
  15. ics_query-0.3.0b0/ics_query/tests/runs/calendars/empty-file.ics +0 -0
  16. ics_query-0.3.0b0/ics_query/tests/runs/calendars/recurring-work-events.ics +223 -0
  17. ics_query-0.3.0b0/ics_query/tests/runs/calendars/simple-journal.ics +15 -0
  18. ics_query-0.3.0b0/ics_query/tests/runs/calendars/simple-todo.ics +15 -0
  19. ics_query-0.3.0b0/ics_query/tests/runs/calendars/three-events.ics +37 -0
  20. ics_query-0.3.0b0/ics_query/tests/runs/first -c VJOURNAL -c VEVENT one-event.ics -.run +9 -0
  21. ics_query-0.3.0b0/ics_query/tests/runs/first -c VJOURNAL one-event.ics -.run +0 -0
  22. ics_query-0.3.0b0/ics_query/tests/runs/first -c VJOURNAL simple-journal.ics -.run +12 -0
  23. ics_query-0.3.0b0/ics_query/tests/runs/first -c VTODO -c VJOURNAL simple-todo.ics -.run +10 -0
  24. ics_query-0.3.0b0/ics_query/tests/runs/first -c VTODO simple-todo.ics -.run +10 -0
  25. ics_query-0.3.0b0/ics_query/tests/runs/first empty-calendar.ics -.run +0 -0
  26. ics_query-0.3.0b0/ics_query/tests/runs/first empty-file.ics -.run +0 -0
  27. ics_query-0.3.0b0/ics_query/tests/runs/first recurring-work-events.ics -.run +12 -0
  28. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/test_command_line.py +11 -0
  29. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/test_parse_date.py +8 -5
  30. ics_query-0.3.0b0/ics_query/tests/test_parse_timedelta.py +25 -0
  31. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/version.py +19 -0
  32. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/pyproject.toml +4 -4
  33. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/tox.ini +3 -1
  34. ics_query-0.1.1a0/ics_query/cli.py +0 -260
  35. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/.github/FUNDING.yml +0 -0
  36. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/.github/dependabot.yml +0 -0
  37. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/.github/workflows/tests.yml +0 -0
  38. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/.gitignore +0 -0
  39. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/LICENSE +0 -0
  40. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics-query +0 -0
  41. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/__main__.py +0 -0
  42. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/__init__.py +0 -0
  43. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/conftest.py +0 -0
  44. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/runs/at 2019-03-04 multiple-calendars.ics -.run +0 -0
  45. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/runs/at 2019-03-04 one-event-twice.ics -.run +0 -0
  46. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/runs/at 2019-03-04 one-event.ics -.run +0 -0
  47. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/runs/at 2019-03-07 multiple-calendars.ics -.run +0 -0
  48. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/runs/calendars/multiple-calendars.ics +0 -0
  49. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/runs/calendars/one-event-twice.ics +0 -0
  50. {ics_query-0.1.1a0 → ics_query-0.3.0b0}/ics_query/tests/runs/calendars/one-event.ics +0 -0
@@ -27,15 +27,9 @@ assignees: ''
27
27
 
28
28
  **Version:**
29
29
  <!-- Which Version do you use? -->
30
- v0.0.1
31
30
 
32
- <!-- Sometimes, the problems are in other packages. You can provide an overview
33
- by running this command and passing the output:
34
-
35
- pip list
36
- -->
37
31
  ```shell
38
- pip list
32
+ $ ics-query --version
39
33
  ```
40
34
 
41
35
  ## Additional context
@@ -45,5 +39,5 @@ pip list
45
39
  <!-- If possible, suggest a way of solving this or just let this text down there remain as it is. -->
46
40
 
47
41
  - [ ] add an ICS file in `ics_query/tests/runs/calendars`
48
- - [ ] add a test in `ics_query/tests/runs directory`
42
+ - [ ] add a test in `ics_query/tests/runs`
49
43
  - [ ] fix the bug and ensure the test code passes
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: ics-query
3
- Version: 0.1.1a0
3
+ Version: 0.3.0b0
4
4
  Summary: Find out what happens in ICS calendar files - query and filter RFC 5545 compatible .ics files for events, journals, TODOs and more.
5
5
  Project-URL: Homepage, https://github.com/niccokunzmann/ics-query/
6
6
  Project-URL: Repository, https://github.com/niccokunzmann/ics-query/
7
- Project-URL: source_archive, https://github.com/niccokunzmann/ics-query/archive/fb12ef2822d23f693aa5f9faaa0cb97fa9f67516.zip
7
+ Project-URL: source_archive, https://github.com/niccokunzmann/ics-query/archive/8a23bc5bc6e89064a99de1e57afdcd94c180181c.zip
8
8
  Project-URL: Issues, https://github.com/niccokunzmann/ics-query/issues
9
9
  Project-URL: Documentation, https://github.com/niccokunzmann/ics-query/
10
10
  Project-URL: Changelog, https://github.com/niccokunzmann/ics-query/#changelog
@@ -686,7 +686,7 @@ License: GNU GENERAL PUBLIC LICENSE
686
686
  <https://www.gnu.org/licenses/why-not-lgpl.html>.
687
687
  License-File: LICENSE
688
688
  Keywords: calendar,command line,icalendar,ics,rfc5545,scheduling
689
- Classifier: Development Status :: 3 - Alpha
689
+ Classifier: Development Status :: 4 - Beta
690
690
  Classifier: Intended Audience :: Developers
691
691
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
692
692
  Classifier: Operating System :: OS Independent
@@ -695,10 +695,11 @@ Classifier: Programming Language :: Python :: 3.10
695
695
  Classifier: Programming Language :: Python :: 3.11
696
696
  Classifier: Programming Language :: Python :: 3.12
697
697
  Classifier: Topic :: Office/Business :: Scheduling
698
- Requires-Python: >=3.8
698
+ Requires-Python: >=3.9
699
699
  Requires-Dist: click
700
700
  Requires-Dist: icalendar
701
- Requires-Dist: recurring-ical-events
701
+ Requires-Dist: recurring-ical-events<4,>=3.2.0
702
+ Requires-Dist: x-wr-timezone
702
703
  Provides-Extra: test
703
704
  Requires-Dist: pytest; extra == 'test'
704
705
  Description-Content-Type: text/markdown
@@ -767,100 +768,199 @@ BEGIN:VEVENT
767
768
  ...
768
769
  ```
769
770
 
771
+ #### Piping calendars
772
+
773
+ You can pipe one or more calendars into the input.
774
+
775
+ ```shell
776
+ cat calendar.ics | ics-query first -
777
+ ```
778
+
770
779
  ### Events at Certain Times
771
780
 
772
781
  You can query which events happen at certain times:
773
782
 
774
783
  ```shell
775
- ics-query at <date-time> calendar.ics -
784
+ ics-query at TIME calendar.ics -
776
785
  ```
777
786
 
778
- `<date-time>` can be built up: It can be a year, a month, a day, an hour, a minute or a second.
787
+ The format of TIME:
788
+
789
+ | TIME | description |
790
+ | ------- | ----------- |
791
+ | `2019` | the whole year 2019 |
792
+ | `2019-08` | August 2019 |
793
+ | `2019-08-12` | 12th of August 2019 |
794
+ | `2019-08-12T17` | 17:00-18:00 at the 12th of August 2019 |
795
+ | `2019-08-12T17:20` | 17:20-17:21 at the 12th of August 2019 |
796
+ | `2019-08-12T17:20:00` | 17:20 at the 12th of August 2019 |
797
+
779
798
 
780
799
  Please see the command documentation for more help:
781
800
 
782
801
  ```shell
783
- ics-query --help
784
802
  ics-query at --help
803
+ ics-query --help
785
804
  ```
786
805
 
787
- ## Vision
788
-
789
- This section shows where we would like to get to.
790
-
791
- ### `ics-query at` - occurrences at certain times
792
-
793
806
  You can get all **events** that happen at a certain **day**.
794
807
 
795
808
  ```shell
796
- ics-query --components VEVENT at 2029-12-24 calendar.ics
809
+ ics-query at --components VEVENT 2029-12-24 calendar.ics
797
810
  ```
798
811
 
799
812
  You can get all **events** that happen **today**.
800
813
 
801
814
  ```shell
802
- ics-query --components VEVENT at `date +%Y-%m-%d` calendar.ics
815
+ ics-query at --components VEVENT `date +%Y-%m-%d` calendar.ics
803
816
  ```
804
817
 
805
818
  You can get all **TODO**s that happen at in certain **month**.
806
819
 
807
820
  ```shell
808
- ics-query --components VTODO at 2029-12-24 calendar.ics
821
+ ics-query at --components VTODO 2029-12-24 calendar.ics
809
822
  ```
810
823
 
811
- ### `ics-query at` - time ranges
824
+ ### Events within a Time Span
812
825
 
826
+ You can query which events happen between certain times:
813
827
 
814
- ### `ics-query --output=count` - count occurrences
828
+ ```shell
829
+ ics-query between START END calendar.ics -
830
+ ics-query between START DURATION calendar.ics -
831
+ ```
815
832
 
833
+ Please see the command documentation for more help:
816
834
 
817
- ### `ics-query --output=ics` - use ics as output (default)
835
+ ```shell
836
+ ics-query between --help
837
+ ics-query --help
838
+ ```
818
839
 
840
+ The format of START and END with examples:
819
841
 
820
- ### `ics-query --select-index` - reduce output size
842
+ | START or END | Description |
843
+ | ------- | ----------- |
844
+ | `2019` | the whole year 2019 |
845
+ | `2019-08` | August 2019 |
846
+ | `2019-08-12` | 12th of August 2019 |
847
+ | `2019-08-12T17` | 17:00-18:00 at the 12th of August 2019 |
848
+ | `2019-08-12T17:20` | 17:20-17:21 at the 12th of August 2019 |
849
+ | `2019-08-12T17:20:00` | 17:20 at the 12th of August 2019 |
821
850
 
822
- Examples: `0,2,4` `0-10`
851
+ Instead of an absolute time, you can specify a duration after the START.
852
+ The `+` is optional.
853
+
854
+ | DURATION | Description |
855
+ | ------- | ----------- |
856
+ | `+1d` | one more day |
857
+ | `+1h` | one more hour |
858
+ | `+1m` | one more minute |
859
+ | `+1s` | one more second |
860
+ | `+3600s` | one more hour or 3600 seconds |
861
+ | `+5d10h` | five more days and 10 more hours |
862
+
863
+ ### Time Span Examples
864
+
865
+ This example returns the occurrences within the **next week**:
866
+
867
+ ```shell
868
+ ics-query between `date +%Y%m%d` +7d calendar.ics -
869
+ ```
870
+
871
+ This example saves the **events** from the **1st of May 2024 to the 10th of June** in
872
+ events.ics:
873
+
874
+ ```shell
875
+ ics-query between --component VEVENT 2024-5-1 2024-6-10 calendar.ics events.ics
876
+ ```
877
+
878
+ In this example, you can check what is happening on **New Years Eve 2025** around
879
+ midnight:
880
+
881
+ ```shell
882
+ ics-query between 2025-12-31T21:00 +6h calendar.ics events.ics
883
+ ```
823
884
 
824
885
  ### `ics-query all` - the whole calendar
825
886
 
826
- ### `ics-query between` - time ranges
887
+ You can get everything that is happening in a calendar but that can be a lot!
827
888
 
828
889
  ```shell
829
- ics-query between dt dt
830
- ics-query between dt duration
890
+ ics-query all calendar.ics
831
891
  ```
832
892
 
833
- ### `ics-query --select-component` - filter for components
893
+ ### Filtering Components
834
894
 
895
+ We support different component types: VEVENT, VJOURNAL and VTODO.
896
+ By default, we include all types in the result.
835
897
 
836
- ### `ics-query --select-uid` - filter by uid
898
+ You can specify which components you would like to get using the
899
+ `--component` or `-c` parameter.
837
900
 
901
+ ```shell
902
+ -c VEVENT # only events
903
+ -c VTODO # only TODOs
904
+ -c VJOURNAL # only journal entries
905
+ -c VEVENT -v VTODO # only events and journal entries
906
+ ```
838
907
 
839
- ## How to edit an event
908
+ This example returns the first event of a calendar.
840
909
 
841
- To edit a component like an event, you can append it to the calendar and increase the sequence number.
910
+ ```shell
911
+ ics-query first -c VEVENT calendar.ics -
912
+ ```
842
913
 
843
- Example:
914
+ This is also available as `ICS_QUERY_COMPONENT` variable.
844
915
 
845
- 1. get the first event `--select-index=0` TODO: recurring-ical-events: set recurrence-id, sequence number
846
- 2. change the summary
847
- 3. increase sequence number
848
- 4. add the event to the end of the calendar file
849
- 5. show that the occurrence has changed
916
+ ```shell
917
+ export ICS_QUERY_COMPONENT=VEVENT
918
+ # from now on, you will get only events
919
+ ics-query first calendar.ics
920
+ ```
850
921
 
851
- ## Piping calendars
922
+ ### Timezones
923
+
924
+ You can set the timezone of the query, otherwise the event's local timezone is used and you
925
+ might miss events in your own timezone.
926
+
927
+ The first event at New Year 2000 in the **event's local time**:
852
928
 
853
929
  ```shell
854
- cat calendar.ics | ics-query --output=count --filter-component=VEVENT all > calendar-event-count.int
930
+ ics-query at 2000-01-01 calendar.ics
855
931
  ```
856
932
 
857
- ## Notifications
933
+ The first event at New Year 2000 in **your local time**:
858
934
 
859
- Examples:
935
+ ```shell
936
+ ics-query at --tz=localtime 2000-01-01 calendar.ics
937
+ ```
860
938
 
861
- - There are x todos in the next hour
862
- - There are x events today
863
- - Please write a journal entry!
939
+ The first event at New Year 2000 in **UTC**:
940
+
941
+ ```shell
942
+ ics-query at --tz=UTC 2000-01-01 calendar.ics
943
+ ```
944
+
945
+ The first event at New Year 2000 in **Berlin time**:
946
+
947
+ ```shell
948
+ ics-query at --tz=Europe/Berlin 2000-01-01 calendar.ics
949
+ ```
950
+
951
+ You can also use the `ICS_QUERY_TZ` variable.
952
+
953
+ ```shell
954
+ export ICS_QUERY_TZ=localtime
955
+ # from now on, we use your local time
956
+ ics-query at 2000-01-01 calendar.ics
957
+ ```
958
+
959
+ For all avaiable timezones see:
960
+
961
+ ```shell
962
+ ics-query --available-timezones
963
+ ```
864
964
 
865
965
  ## Version Fixing
866
966
 
@@ -920,7 +1020,7 @@ Run this to format the code and show problems:
920
1020
  tox -e ruff
921
1021
  ```
922
1022
 
923
- ## New Release
1023
+ ### New Release
924
1024
 
925
1025
  To release new versions,
926
1026
 
@@ -938,10 +1038,24 @@ To release new versions,
938
1038
 
939
1039
  ## Changelog
940
1040
 
1041
+ - v0.3.0b
1042
+
1043
+ - Add `--tz` timezone parameter
1044
+ - Add `ics-query all` to get all occurrences
1045
+
1046
+ - v0.2.1a
1047
+
1048
+ - Add `--component` to filter component types VEVENT, VJOURNAL and VTODO
1049
+
1050
+ - v0.2.0a
1051
+
1052
+ - Add `ics-query first <calendar> <output>` for earliest occurrences
1053
+ - Add `ics-query between <span_start> <span_stop> <calendar> <output>` to query time ranges
1054
+
941
1055
  - v0.1.1a
942
1056
 
943
1057
  - Add `--version`
944
- - Add `ics-query at <date>`
1058
+ - Add `ics-query at <date> <calendar> <output>`
945
1059
  - Add support for multiple calendars in one input
946
1060
 
947
1061
  - v0.1.0a
@@ -952,3 +1066,39 @@ To release new versions,
952
1066
  - v0.0.1a
953
1067
 
954
1068
  - first version
1069
+
1070
+ ## Related Work
1071
+
1072
+ - [icalBuddy](https://hasseg.org/icalBuddy/)
1073
+
1074
+ ## Vision
1075
+
1076
+ This section shows where we would like to get to.
1077
+
1078
+ ### `ics-query --select-index` - reduce output size
1079
+
1080
+ Examples: `0,2,4` `0-10`
1081
+
1082
+
1083
+ ### `ics-query --select-uid` - filter by uid
1084
+
1085
+ ### How to edit an event
1086
+
1087
+ To edit a component like an event, you can append it to the calendar and increase the sequence number.
1088
+
1089
+ Example:
1090
+
1091
+ 1. get the event `--select-index=0`
1092
+ 2. change the summary
1093
+ 3. increase sequence number
1094
+ 4. add the event to the end of the calendar file
1095
+ 5. show that the occurrence has changed
1096
+
1097
+
1098
+ ### Notifications
1099
+
1100
+ Examples:
1101
+
1102
+ - There are x todos in the next hour
1103
+ - There are x events today
1104
+ - Please write a journal entry!
@@ -62,100 +62,199 @@ BEGIN:VEVENT
62
62
  ...
63
63
  ```
64
64
 
65
+ #### Piping calendars
66
+
67
+ You can pipe one or more calendars into the input.
68
+
69
+ ```shell
70
+ cat calendar.ics | ics-query first -
71
+ ```
72
+
65
73
  ### Events at Certain Times
66
74
 
67
75
  You can query which events happen at certain times:
68
76
 
69
77
  ```shell
70
- ics-query at <date-time> calendar.ics -
78
+ ics-query at TIME calendar.ics -
71
79
  ```
72
80
 
73
- `<date-time>` can be built up: It can be a year, a month, a day, an hour, a minute or a second.
81
+ The format of TIME:
82
+
83
+ | TIME | description |
84
+ | ------- | ----------- |
85
+ | `2019` | the whole year 2019 |
86
+ | `2019-08` | August 2019 |
87
+ | `2019-08-12` | 12th of August 2019 |
88
+ | `2019-08-12T17` | 17:00-18:00 at the 12th of August 2019 |
89
+ | `2019-08-12T17:20` | 17:20-17:21 at the 12th of August 2019 |
90
+ | `2019-08-12T17:20:00` | 17:20 at the 12th of August 2019 |
91
+
74
92
 
75
93
  Please see the command documentation for more help:
76
94
 
77
95
  ```shell
78
- ics-query --help
79
96
  ics-query at --help
97
+ ics-query --help
80
98
  ```
81
99
 
82
- ## Vision
83
-
84
- This section shows where we would like to get to.
85
-
86
- ### `ics-query at` - occurrences at certain times
87
-
88
100
  You can get all **events** that happen at a certain **day**.
89
101
 
90
102
  ```shell
91
- ics-query --components VEVENT at 2029-12-24 calendar.ics
103
+ ics-query at --components VEVENT 2029-12-24 calendar.ics
92
104
  ```
93
105
 
94
106
  You can get all **events** that happen **today**.
95
107
 
96
108
  ```shell
97
- ics-query --components VEVENT at `date +%Y-%m-%d` calendar.ics
109
+ ics-query at --components VEVENT `date +%Y-%m-%d` calendar.ics
98
110
  ```
99
111
 
100
112
  You can get all **TODO**s that happen at in certain **month**.
101
113
 
102
114
  ```shell
103
- ics-query --components VTODO at 2029-12-24 calendar.ics
115
+ ics-query at --components VTODO 2029-12-24 calendar.ics
104
116
  ```
105
117
 
106
- ### `ics-query at` - time ranges
118
+ ### Events within a Time Span
107
119
 
120
+ You can query which events happen between certain times:
108
121
 
109
- ### `ics-query --output=count` - count occurrences
122
+ ```shell
123
+ ics-query between START END calendar.ics -
124
+ ics-query between START DURATION calendar.ics -
125
+ ```
110
126
 
127
+ Please see the command documentation for more help:
111
128
 
112
- ### `ics-query --output=ics` - use ics as output (default)
129
+ ```shell
130
+ ics-query between --help
131
+ ics-query --help
132
+ ```
113
133
 
134
+ The format of START and END with examples:
114
135
 
115
- ### `ics-query --select-index` - reduce output size
136
+ | START or END | Description |
137
+ | ------- | ----------- |
138
+ | `2019` | the whole year 2019 |
139
+ | `2019-08` | August 2019 |
140
+ | `2019-08-12` | 12th of August 2019 |
141
+ | `2019-08-12T17` | 17:00-18:00 at the 12th of August 2019 |
142
+ | `2019-08-12T17:20` | 17:20-17:21 at the 12th of August 2019 |
143
+ | `2019-08-12T17:20:00` | 17:20 at the 12th of August 2019 |
116
144
 
117
- Examples: `0,2,4` `0-10`
145
+ Instead of an absolute time, you can specify a duration after the START.
146
+ The `+` is optional.
147
+
148
+ | DURATION | Description |
149
+ | ------- | ----------- |
150
+ | `+1d` | one more day |
151
+ | `+1h` | one more hour |
152
+ | `+1m` | one more minute |
153
+ | `+1s` | one more second |
154
+ | `+3600s` | one more hour or 3600 seconds |
155
+ | `+5d10h` | five more days and 10 more hours |
156
+
157
+ ### Time Span Examples
158
+
159
+ This example returns the occurrences within the **next week**:
160
+
161
+ ```shell
162
+ ics-query between `date +%Y%m%d` +7d calendar.ics -
163
+ ```
164
+
165
+ This example saves the **events** from the **1st of May 2024 to the 10th of June** in
166
+ events.ics:
167
+
168
+ ```shell
169
+ ics-query between --component VEVENT 2024-5-1 2024-6-10 calendar.ics events.ics
170
+ ```
171
+
172
+ In this example, you can check what is happening on **New Years Eve 2025** around
173
+ midnight:
174
+
175
+ ```shell
176
+ ics-query between 2025-12-31T21:00 +6h calendar.ics events.ics
177
+ ```
118
178
 
119
179
  ### `ics-query all` - the whole calendar
120
180
 
121
- ### `ics-query between` - time ranges
181
+ You can get everything that is happening in a calendar but that can be a lot!
122
182
 
123
183
  ```shell
124
- ics-query between dt dt
125
- ics-query between dt duration
184
+ ics-query all calendar.ics
126
185
  ```
127
186
 
128
- ### `ics-query --select-component` - filter for components
187
+ ### Filtering Components
129
188
 
189
+ We support different component types: VEVENT, VJOURNAL and VTODO.
190
+ By default, we include all types in the result.
130
191
 
131
- ### `ics-query --select-uid` - filter by uid
192
+ You can specify which components you would like to get using the
193
+ `--component` or `-c` parameter.
132
194
 
195
+ ```shell
196
+ -c VEVENT # only events
197
+ -c VTODO # only TODOs
198
+ -c VJOURNAL # only journal entries
199
+ -c VEVENT -v VTODO # only events and journal entries
200
+ ```
133
201
 
134
- ## How to edit an event
202
+ This example returns the first event of a calendar.
135
203
 
136
- To edit a component like an event, you can append it to the calendar and increase the sequence number.
204
+ ```shell
205
+ ics-query first -c VEVENT calendar.ics -
206
+ ```
137
207
 
138
- Example:
208
+ This is also available as `ICS_QUERY_COMPONENT` variable.
139
209
 
140
- 1. get the first event `--select-index=0` TODO: recurring-ical-events: set recurrence-id, sequence number
141
- 2. change the summary
142
- 3. increase sequence number
143
- 4. add the event to the end of the calendar file
144
- 5. show that the occurrence has changed
210
+ ```shell
211
+ export ICS_QUERY_COMPONENT=VEVENT
212
+ # from now on, you will get only events
213
+ ics-query first calendar.ics
214
+ ```
145
215
 
146
- ## Piping calendars
216
+ ### Timezones
217
+
218
+ You can set the timezone of the query, otherwise the event's local timezone is used and you
219
+ might miss events in your own timezone.
220
+
221
+ The first event at New Year 2000 in the **event's local time**:
147
222
 
148
223
  ```shell
149
- cat calendar.ics | ics-query --output=count --filter-component=VEVENT all > calendar-event-count.int
224
+ ics-query at 2000-01-01 calendar.ics
150
225
  ```
151
226
 
152
- ## Notifications
227
+ The first event at New Year 2000 in **your local time**:
153
228
 
154
- Examples:
229
+ ```shell
230
+ ics-query at --tz=localtime 2000-01-01 calendar.ics
231
+ ```
155
232
 
156
- - There are x todos in the next hour
157
- - There are x events today
158
- - Please write a journal entry!
233
+ The first event at New Year 2000 in **UTC**:
234
+
235
+ ```shell
236
+ ics-query at --tz=UTC 2000-01-01 calendar.ics
237
+ ```
238
+
239
+ The first event at New Year 2000 in **Berlin time**:
240
+
241
+ ```shell
242
+ ics-query at --tz=Europe/Berlin 2000-01-01 calendar.ics
243
+ ```
244
+
245
+ You can also use the `ICS_QUERY_TZ` variable.
246
+
247
+ ```shell
248
+ export ICS_QUERY_TZ=localtime
249
+ # from now on, we use your local time
250
+ ics-query at 2000-01-01 calendar.ics
251
+ ```
252
+
253
+ For all avaiable timezones see:
254
+
255
+ ```shell
256
+ ics-query --available-timezones
257
+ ```
159
258
 
160
259
  ## Version Fixing
161
260
 
@@ -215,7 +314,7 @@ Run this to format the code and show problems:
215
314
  tox -e ruff
216
315
  ```
217
316
 
218
- ## New Release
317
+ ### New Release
219
318
 
220
319
  To release new versions,
221
320
 
@@ -233,10 +332,24 @@ To release new versions,
233
332
 
234
333
  ## Changelog
235
334
 
335
+ - v0.3.0b
336
+
337
+ - Add `--tz` timezone parameter
338
+ - Add `ics-query all` to get all occurrences
339
+
340
+ - v0.2.1a
341
+
342
+ - Add `--component` to filter component types VEVENT, VJOURNAL and VTODO
343
+
344
+ - v0.2.0a
345
+
346
+ - Add `ics-query first <calendar> <output>` for earliest occurrences
347
+ - Add `ics-query between <span_start> <span_stop> <calendar> <output>` to query time ranges
348
+
236
349
  - v0.1.1a
237
350
 
238
351
  - Add `--version`
239
- - Add `ics-query at <date>`
352
+ - Add `ics-query at <date> <calendar> <output>`
240
353
  - Add support for multiple calendars in one input
241
354
 
242
355
  - v0.1.0a
@@ -247,3 +360,39 @@ To release new versions,
247
360
  - v0.0.1a
248
361
 
249
362
  - first version
363
+
364
+ ## Related Work
365
+
366
+ - [icalBuddy](https://hasseg.org/icalBuddy/)
367
+
368
+ ## Vision
369
+
370
+ This section shows where we would like to get to.
371
+
372
+ ### `ics-query --select-index` - reduce output size
373
+
374
+ Examples: `0,2,4` `0-10`
375
+
376
+
377
+ ### `ics-query --select-uid` - filter by uid
378
+
379
+ ### How to edit an event
380
+
381
+ To edit a component like an event, you can append it to the calendar and increase the sequence number.
382
+
383
+ Example:
384
+
385
+ 1. get the event `--select-index=0`
386
+ 2. change the summary
387
+ 3. increase sequence number
388
+ 4. add the event to the end of the calendar file
389
+ 5. show that the occurrence has changed
390
+
391
+
392
+ ### Notifications
393
+
394
+ Examples:
395
+
396
+ - There are x todos in the next hour
397
+ - There are x events today
398
+ - Please write a journal entry!
@@ -1,11 +1,12 @@
1
- from .cli import main
1
+ from .cli import cli, main
2
2
  from .version import __version__, __version_tuple__, version, version_tuple
3
3
 
4
4
  __all__ = [
5
- "main",
5
+ "cli",
6
6
  "app",
7
7
  "__version__",
8
8
  "version",
9
9
  "__version_tuple__",
10
10
  "version_tuple",
11
+ "main",
11
12
  ]
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.1.1a0'
16
- __version_tuple__ = version_tuple = (0, 1, 1)
15
+ __version__ = version = '0.3.0b0'
16
+ __version_tuple__ = version_tuple = (0, 3, 0)