syslog2irc.cli   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 19
dl 0
loc 41
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A parse_args() 0 4 1
A _create_arg_parser() 0 16 1
1
"""
2
syslog2irc.cli
3
~~~~~~~~~~~~~~
4
5
Command line argument parsing
6
7
:Copyright: 2007-2021 Jochen Kupperschmidt
8
:License: MIT, see LICENSE for details.
9
"""
10
11 1
from __future__ import annotations
12 1
from argparse import ArgumentParser, Namespace
13 1
from pathlib import Path
14 1
from typing import Optional
15
16 1
from . import VERSION
17
18
19 1
def parse_args(args: Optional[list[str]] = None) -> Namespace:
20
    """Parse command line arguments."""
21 1
    parser = _create_arg_parser()
22 1
    return parser.parse_args(args)
23
24
25 1
def _create_arg_parser() -> ArgumentParser:
26
    """Prepare the command line arguments parser."""
27 1
    parser = ArgumentParser()
28
29 1
    parser.add_argument(
30
        '--version',
31
        action='version',
32
        version=f'syslog2IRC {VERSION}',
33
    )
34
35 1
    parser.add_argument(
36
        'config_filename',
37
        type=Path,
38
    )
39
40
    return parser
41