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.application import Application 

2from cleo.io.io import IO 

3from cleo.io.outputs.output import Verbosity 

4from pystratum_backend.StratumIO import StratumIO 

5 

6from pystratum_cli.command.ConstantsCommand import ConstantsCommand 

7from pystratum_cli.command.RoutineLoaderCommand import RoutineLoaderCommand 

8from pystratum_cli.command.RoutineWrapperCommand import RoutineWrapperCommand 

9from pystratum_cli.command.StratumCommand import StratumCommand 

10 

11 

12class StratumApplication(Application): 

13 """ 

14 The PyStratum application. 

15 """ 

16 

17 # ------------------------------------------------------------------------------------------------------------------ 

18 def __init__(self): 

19 """ 

20 Object constructor 

21 """ 

22 Application.__init__(self, 'pystratum', '1.0.4') 

23 

24 self.add(ConstantsCommand()) 

25 self.add(RoutineLoaderCommand()) 

26 self.add(StratumCommand()) 

27 self.add(RoutineWrapperCommand()) 

28 

29 # ------------------------------------------------------------------------------------------------------------------ 

30 def render_error(self, error: Exception, io: IO) -> None: 

31 if io.output.verbosity == Verbosity.NORMAL: 

32 my_io = StratumIO(io.input, io.output, io.error_output) 

33 lines = [error.__class__.__name__, str(error)] 

34 my_io.error(lines) 

35 else: 

36 Application.render_error(self, error, io) 

37 

38# ----------------------------------------------------------------------------------------------------------------------