Completed
Push — master ( 5db226...8f2faa )
by P.R.
03:03
created

SDocCommand.handle()   A

Complexity

Conditions 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
cc 1
crap 1
1
"""
2
SDoc
3
4
Copyright 2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
# ----------------------------------------------------------------------------------------------------------------------
9 1
from sdoc.SDoc import SDoc
10 1
from sdoc.command.BaseCommand import BaseCommand
11 1
from sdoc.style.SdocStyle import SdocStyle
12
13
14 1
class SDocCommand(BaseCommand):
15
    """
16
    Generates the target document(s)
17
    """
18 1
    name = 'sdoc'
19
20 1
    arguments = [
21
        {
22
            'name':        'config.cfg',
23
            'description': 'The name of the config file',
24
            'required':    True
25
        },
26
        {
27
            'name':        'main.sdoc',
28
            'description': "The SDoc file",
29
            'required':    True
30
        }
31
    ]
32
33
    # ------------------------------------------------------------------------------------------------------------------
34 1
    def handle(self):
35
        """
36
        Reads the arguments and starts SDoc application.
37
        """
38 1
        self._io = SdocStyle(self.input, self.output)
39
40 1
        sdoc = SDoc()
41 1
        sdoc.io = self._io
42 1
        sdoc.config_path = self.argument('config.cfg')
43
44 1
        return sdoc.run_sdoc(self.argument('main.sdoc'))
45
46
# ----------------------------------------------------------------------------------------------------------------------
47