Coverage for pystratum_cli/command/ConstantsCommand.py: 100%
11 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-05-12 12:02 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2024-05-12 12:02 +0200
1from pystratum_cli.command.BaseCommand import BaseCommand
4class ConstantsCommand(BaseCommand):
5 """
6 Generates constants based on database IDs.
8 constants
9 {config_file : The stratum configuration file}
10 """
12 # ------------------------------------------------------------------------------------------------------------------
13 def handle(self) -> int:
14 """
15 Executes constants command when StratumCommand is activated.
16 """
17 self._read_config_file(self.input)
19 factory = self._create_backend_factory()
20 worker = factory.create_constant_worker(self._config, self._io)
22 if not worker:
23 self._io.title('Constants')
24 self._io.error('Constants command is not implemented by the backend')
25 return -1
27 return worker.execute()
29# ----------------------------------------------------------------------------------------------------------------------