Total Complexity | 2 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 73.32% |
Changes | 0 |
1 | """ |
||
2 | weitersager.cli |
||
3 | ~~~~~~~~~~~~~~~ |
||
4 | |||
5 | Command line entry point |
||
6 | |||
7 | :Copyright: 2007-2020 Jochen Kupperschmidt |
||
8 | :License: MIT, see LICENSE for details. |
||
9 | """ |
||
10 | |||
11 | 1 | from argparse import ArgumentParser |
|
12 | 1 | from pathlib import Path |
|
13 | 1 | import sys |
|
14 | |||
15 | 1 | from .config import load_config |
|
16 | 1 | from .processor import start |
|
17 | |||
18 | |||
19 | 1 | def parse_args(args): |
|
20 | """Parse command line arguments.""" |
||
21 | 1 | parser = ArgumentParser(prog='weitersager') |
|
22 | 1 | parser.add_argument('config_filename', type=Path) |
|
23 | 1 | return parser.parse_args(args) |
|
24 | |||
25 | |||
26 | 1 | def main(): |
|
27 | """Load the configuration file, start the IRC bot and HTTP listen server.""" |
||
28 | namespace = parse_args(sys.argv[1:]) |
||
29 | |||
30 | irc_config, http_config = load_config(namespace.config_filename) |
||
31 | |||
32 | start(irc_config, http_config) |
||
33 | |||
34 | |||
35 | 1 | if __name__ == '__main__': |
|
36 | main() |
||
37 |