Test Failed
Pull Request — master (#324)
by
unknown
07:52 queued 03:21
created

kytos.cli.commands.web.parser.parse()   A

Complexity

Conditions 2

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 7
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
ccs 0
cts 7
cp 0
crap 6
1
"""kytos - The kytos command line.
2
3
You are at the "web" command.
4
5
Usage:
6
       kytos web update
7
       kytos web update <version>
8
9
Options:
10
11
  -h, --help    Show this screen.
12
13
Common web subcommands:
14
15
  update        Update the web-ui with the latest version
16
17
"""
18
import sys
19
20
from docopt import docopt
21
22
from kytos.cli.commands.web.api import WebAPI
23
from kytos.utils.config import KytosConfig
24
from kytos.utils.exceptions import KytosException
25
26
27
def parse(argv):
28
    """Parse cli args."""
29
    args = docopt(__doc__, argv=argv)
30
    try:
31
        call(sys.argv[2], args)
32
    except KytosException as exception:
33
        print("Error parsing args: {}".format(exception))
34
        sys.exit()
35
36
37
def call(subcommand, args):  # pylint: disable=unused-argument
38
    """Call a subcommand passing the args."""
39
    KytosConfig.check_versions()
40
    func = getattr(WebAPI, subcommand)
41
    func(args)
42