-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__main__.py
More file actions
56 lines (46 loc) · 1.44 KB
/
Copy path__main__.py
File metadata and controls
56 lines (46 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""
Entry point for Cal-Bridge when invoked as a Python module:
python -m cal_bridge [--config PATH] [--week-mapping PATH] [--output DIR]
Run from the project root directory (F:\\Code\\Cal-Bridge).
"""
import argparse
import sys
import os
# Ensure the project root is on sys.path so 'src' is importable as a package.
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from src.main import main
def cli():
parser = argparse.ArgumentParser(
prog='python -m cal_bridge',
description=(
'Cal-Bridge: Convert XJTLU TimetablePlus timetable data '
'into an ICS calendar file importable by Google Calendar, '
'Outlook, Apple Calendar, and others.'
),
)
parser.add_argument(
'--config',
default='config.json',
metavar='PATH',
help='Path to the configuration file (default: config.json)',
)
parser.add_argument(
'--week-mapping',
default='week_mapping.json',
metavar='PATH',
help='Path to the week mapping file (default: week_mapping.json)',
)
parser.add_argument(
'--output',
default=None,
metavar='DIR',
help='Output directory for the generated ICS file (default: output/)',
)
args = parser.parse_args()
main(
config_path=args.config,
week_mapping_path=args.week_mapping,
output_dir=args.output,
)
if __name__ == '__main__':
cli()