pystratum_cli.command.RoutineWrapperCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 31
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A RoutineWrapperCommand.handle() 0 15 2
1 1
from cleo.helpers import argument
2
3
from pystratum_cli.command.BaseCommand import BaseCommand
4 1
5
6
class RoutineWrapperCommand(BaseCommand):
7
    """
8
    Command for generating a class with wrapper methods for invoking stored routines in a database instance.
9
    """
10
    name = 'wrapper'
11
    description = ('Command for generating a class with wrapper methods for invoking stored routines in a database '
12
                   'instance.')
13 1
    arguments = [argument(name='config_file', description='The stratum configuration file.')]
14
15
    # ------------------------------------------------------------------------------------------------------------------
16
    def handle(self) -> int:
17 1
        """
18
        Executes constants command when StratumCommand is activated.
19 1
        """
20 1
        self._read_config_file()
21
22 1
        factory = self._create_backend_factory()
23 1
        worker = factory.create_routine_wrapper_generator_worker(self._config, self._io)
24 1
25 1
        if not worker:
26
            self._io.title('Wrapper')
27 1
            self._io.error('<error>Wrapper command is not implemented by the backend</>')
28
            return -1
29
30
        return worker.execute()
31
32
# ----------------------------------------------------------------------------------------------------------------------
33