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

weitersager.cli   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 36
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Functions

Rating   Name   Duplication   Size   Complexity  
A parse_args() 0 5 1
A main() 0 7 1
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