Completed
Branch development (19ca9f)
by Jochen
02:17
created

weitersager.cli.main()   A

Complexity

Conditions 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nop 0
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 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