Total Complexity | 2 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 0% |
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 | from argparse import ArgumentParser |
||
12 | from pathlib import Path |
||
13 | |||
14 | from .config import load_config |
||
15 | from .processor import start |
||
16 | |||
17 | |||
18 | def parse_args(): |
||
19 | """Parse command line arguments.""" |
||
20 | parser = ArgumentParser(prog='weitersager') |
||
21 | parser.add_argument('config_filename', type=Path) |
||
22 | return parser.parse_args() |
||
23 | |||
24 | |||
25 | def main(): |
||
26 | """Load the configuration file, start the IRC bot and HTTP listen server.""" |
||
27 | args = parse_args() |
||
28 | |||
29 | irc_config, http_host, http_port = load_config(args.config_filename) |
||
30 | |||
31 | start(irc_config, http_host, http_port) |
||
32 | |||
33 | |||
34 | if __name__ == '__main__': |
||
35 | main() |
||
36 |