Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from cleo.helpers import argument 

2 

3from pystratum_cli.command.BaseCommand import BaseCommand 

4 

5 

6class ConstantsCommand(BaseCommand): 

7 """ 

8 Generates constants based on database IDs. 

9 """ 

10 name = 'constants' 

11 description = 'Generates constants based on database IDs.' 

12 arguments = [argument(name='config_file', description='The stratum configuration file.')] 

13 

14 # ------------------------------------------------------------------------------------------------------------------ 

15 def handle(self) -> int: 

16 """ 

17 Executes constants command when StratumCommand is activated. 

18 """ 

19 self._read_config_file() 

20 

21 factory = self._create_backend_factory() 

22 worker = factory.create_constant_worker(self._config, self._io) 

23 

24 if not worker: 

25 self._io.title('Constants') 

26 self._io.error('Constants command is not implemented by the backend') 

27 return -1 

28 

29 return worker.execute() 

30 

31# ----------------------------------------------------------------------------------------------------------------------