Skip to content

Commit 3146a9c

Browse files
Merge pull request #84 from pycalendar/issue-36
WIP: Add documentation website
2 parents e2eb69e + 60be616 commit 3146a9c

File tree

12 files changed

+601
-1
lines changed

12 files changed

+601
-1
lines changed

.readthedocs.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
formats: all
3+
build:
4+
os: ubuntu-24.04
5+
tools:
6+
python: "3.14"
7+
commands:
8+
- git fetch --tags
9+
- pip install -r docs/requirements.txt
10+
- pip install -e .
11+
- sphinx-build docs/ $READTHEDOCS_OUTPUT/html/

docs/Makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
SPHINXBUILD = .venv/bin/sphinx-build
2+
DOCS_DIR = .
3+
BUILDDIR = _build
4+
5+
.venv:
6+
python -m venv .venv
7+
.venv/bin/pip install -r requirements.txt
8+
.venv/bin/pip install -e ..
9+
10+
html: .venv
11+
$(SPHINXBUILD) -W $(DOCS_DIR) $(BUILDDIR)/html
12+
13+
clean:
14+
rm -rf $(BUILDDIR) .venv

docs/conf.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import datetime
2+
import importlib.metadata
3+
4+
project = "ics-query"
5+
this_year = datetime.date.today().year
6+
copyright = f"{this_year}, Nicco Kunzmann"
7+
release = version = importlib.metadata.version("ics-query")
8+
9+
extensions = [
10+
"sphinx.ext.intersphinx",
11+
"sphinx_copybutton",
12+
"myst_parser",
13+
]
14+
15+
html_theme = "pydata_sphinx_theme"
16+
html_theme_options = {
17+
"github_url": "https://github.com/pycalendar/ics-query",
18+
"icon_links": [
19+
{
20+
"name": "PyPI",
21+
"url": "https://pypi.org/project/ics-query",
22+
"icon": "fa-solid fa-download",
23+
"type": "fontawesome",
24+
},
25+
],
26+
}

docs/download.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Download
2+
3+
Pre-built binaries are available on the [Releases] page.
4+
No Python installation required.
5+
6+
## Windows
7+
8+
Download `ics-query.exe` from the [Releases] page and run it directly:
9+
10+
```shell
11+
ics-query.exe --version
12+
```
13+
14+
## Linux (x86_64)
15+
16+
Download `ics-query-linux-x86_64` from the [Releases] page.
17+
Make it executable and run it:
18+
19+
```shell
20+
chmod +x ics-query-linux-x86_64
21+
./ics-query-linux-x86_64 --version
22+
```
23+
24+
To use it without the path prefix, move it somewhere on your PATH:
25+
26+
```shell
27+
mv ics-query-linux-x86_64 ~/.local/bin/ics-query
28+
ics-query --version
29+
```
30+
31+
## macOS
32+
33+
macOS binaries are not provided.
34+
Use [Homebrew or pip](install.md) instead.
35+
36+
## Verifying the download
37+
38+
After downloading, check that the version matches the release you downloaded:
39+
40+
```shell
41+
ics-query --version
42+
```
43+
44+
[Releases]: https://github.com/pycalendar/ics-query/releases

docs/examples.md

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
# Examples
2+
3+
`ics-query` takes a command, a time argument, one or more calendar files, and an output.
4+
Pass `-` as the calendar to read from stdin. Pass `-` as the output to write to stdout.
5+
6+
```shell
7+
ics-query at 2019-03-04 calendar.ics -
8+
```
9+
10+
## Events at a specific time
11+
12+
Use `at` to get all occurrences at a date, month, year, or precise time.
13+
14+
Get everything happening on a specific day:
15+
16+
```shell
17+
ics-query at 2019-03-04 calendar.ics -
18+
```
19+
20+
Get everything happening this month:
21+
22+
```shell
23+
ics-query at `date +%Y-%m` calendar.ics -
24+
```
25+
26+
Get everything happening right now (to the second):
27+
28+
```shell
29+
ics-query at `date +%Y%m%d%H%M%S` calendar.ics -
30+
```
31+
32+
Accepted time formats for `at` and for the `START` argument of `between`:
33+
34+
| Format | Description |
35+
| ------ | ----------- |
36+
| `2019` | all of 2019 |
37+
| `2019-08` | August 2019 |
38+
| `2019-08-12` | 12 August 2019 |
39+
| `2019-08-12T17` | 17:00 to 18:00 on 12 August 2019 |
40+
| `2019-08-12T17:20` | 17:20 to 17:21 on 12 August 2019 |
41+
| `2019-08-12T17:20:00` | exactly 17:20:00 on 12 August 2019 |
42+
43+
Compact formats without separators are also accepted: `20190812`, `20190812T1720`, `201908121720`.
44+
45+
## Events within a time span
46+
47+
Use `between` to get occurrences between a start and an end.
48+
Start is inclusive, end is exclusive.
49+
50+
Get events in the next 7 days:
51+
52+
```shell
53+
ics-query between `date +%Y%m%d` +7d calendar.ics -
54+
```
55+
56+
Get events between two specific dates:
57+
58+
```shell
59+
ics-query between 2024-05-01 2024-06-10 calendar.ics events.ics
60+
```
61+
62+
Get events around New Year's Eve midnight:
63+
64+
```shell
65+
ics-query between 2025-12-31T21:00 +6h calendar.ics -
66+
```
67+
68+
The `END` argument can be a relative duration after `START`:
69+
70+
| Duration | Description |
71+
| -------- | ----------- |
72+
| `+1d` | one day |
73+
| `+1h` | one hour |
74+
| `+1m` | one minute |
75+
| `+1s` | one second |
76+
| `+3600s` | one hour as seconds |
77+
| `+5d10h` | five days and 10 hours |
78+
79+
The `+` prefix is optional.
80+
81+
## First occurrence
82+
83+
Use `first` to get only the first occurrence in each calendar file.
84+
85+
```shell
86+
ics-query first calendar.ics -
87+
```
88+
89+
## All occurrences
90+
91+
Use `all` to get every occurrence in a calendar.
92+
93+
```shell
94+
ics-query all calendar.ics -
95+
```
96+
97+
Calendars with recurring events can produce a very large number of occurrences.
98+
Use `head` to limit the output:
99+
100+
```shell
101+
ics-query all calendar.ics - | head -100
102+
```
103+
104+
## Filtering by component type
105+
106+
By default, `ics-query` returns `VEVENT`, `VTODO`, and `VJOURNAL` components.
107+
Use `-c` or `--component` to filter.
108+
109+
Only events:
110+
111+
```shell
112+
ics-query at 2024-08 -c VEVENT calendar.ics -
113+
```
114+
115+
Only to-dos:
116+
117+
```shell
118+
ics-query at 2024-08 -c VTODO calendar.ics -
119+
```
120+
121+
Only journal entries:
122+
123+
```shell
124+
ics-query at 2024-08 -c VJOURNAL calendar.ics -
125+
```
126+
127+
Pass `-c` multiple times to include more than one type:
128+
129+
```shell
130+
ics-query at 2024-08 -c VEVENT -c VTODO calendar.ics -
131+
```
132+
133+
You can also set the component via environment variable:
134+
135+
```shell
136+
export ICS_QUERY_COMPONENT=VEVENT
137+
ics-query at 2024-08 calendar.ics -
138+
```
139+
140+
## Querying alarms
141+
142+
Use `-c VALARM` to query components by their alarm times.
143+
`VALARM` is not included in the default output.
144+
145+
Alarms behave differently from other components:
146+
147+
- The parent component (`VEVENT`, `VTODO`) may fall outside the queried time span
148+
while the alarm falls within it, and it will still be included.
149+
- Absolute alarms may appear only once, not for every recurrence.
150+
- Each result contains only one alarm.
151+
- Do not mix `-c VALARM` with other types. You will not be able to tell whether
152+
the alarm or the parent component matched the time span.
153+
154+
Get all alarms and show their trigger time and event summary:
155+
156+
```shell
157+
ics-query all -c VALARM calendar.ics - | grep -E 'TRIGGER|SUMMARY'
158+
```
159+
160+
## Timezones
161+
162+
By default, `ics-query` uses each component's own timezone.
163+
Two events at 6am in different timezones both appear when you query by date,
164+
even though they are hours apart in absolute time.
165+
166+
Use `--tz` to query in a specific timezone:
167+
168+
```shell
169+
ics-query at --tz=Europe/Berlin 2024-08-20 calendar.ics -
170+
```
171+
172+
Use `--tz=localtime` to query in your local system timezone:
173+
174+
```shell
175+
ics-query at --tz=localtime 2024-08-20 calendar.ics -
176+
```
177+
178+
Use `--tz=UTC` for UTC:
179+
180+
```shell
181+
ics-query at --tz=UTC 2024-08-20 calendar.ics -
182+
```
183+
184+
Set the timezone via environment variable:
185+
186+
```shell
187+
export ICS_QUERY_TZ=Europe/Berlin
188+
ics-query at 2024-08-20 calendar.ics -
189+
```
190+
191+
List all available timezone names:
192+
193+
```shell
194+
ics-query --available-timezones
195+
```
196+
197+
## Valid ICS output
198+
199+
By default, the output contains only the matched components with no `VCALENDAR` wrapper
200+
and no `VTIMEZONE`. This is intentional for piping into other tools.
201+
202+
To produce a valid `.ics` file that calendar applications can open, use `--as-calendar`:
203+
204+
```shell
205+
ics-query at --as-calendar 2014-05-03 calendar.ics output.ics
206+
```
207+
208+
The output is wrapped in a `VCALENDAR` block and includes any `VTIMEZONE` components
209+
from the source calendar.
210+
211+
You can also set this via environment variable:
212+
213+
```shell
214+
export ICS_QUERY_AS_CALENDAR=1
215+
ics-query at 2014-05-03 calendar.ics output.ics
216+
```
217+
218+
## Multiple calendars
219+
220+
Pass multiple files directly:
221+
222+
```shell
223+
ics-query at 2024-08 calendar1.ics calendar2.ics -
224+
```
225+
226+
Or concatenate them through stdin:
227+
228+
```shell
229+
cat calendar1.ics calendar2.ics | ics-query at 2024-08 - -
230+
```
231+
232+
## Fetching a calendar from the web
233+
234+
```shell
235+
wget -qO- 'https://example.com/calendar.ics' | ics-query at 2024-08 - -
236+
```

docs/index.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# ics-query
2+
3+
Find out what happens in ICS calendar files - query and filter RFC 5545 compatible `.ics` files for events, journals, TODOs and more.
4+
5+
```{toctree}
6+
:maxdepth: 1
7+
8+
overview
9+
install
10+
download
11+
examples
12+
maintenance
13+
```

0 commit comments

Comments
 (0)