Total Complexity | 4 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 91.67% |
Changes | 0 |
1 | from typing import Union |
||
2 | |||
3 | from cleo import Input, Output |
||
4 | 1 | from cleo.styles import CleoStyle |
|
5 | |||
6 | 1 | ||
7 | 1 | class KerapuStyle(CleoStyle): |
|
8 | """ |
||
9 | Output style for Kerapu. |
||
10 | 1 | """ |
|
11 | |||
12 | # ------------------------------------------------------------------------------------------------------------------ |
||
13 | def __init__(self, input_object: Input, output_object: Output) -> None: |
||
14 | """ |
||
15 | Object constructor. |
||
16 | 1 | ||
17 | :param Input input_object: The input object. |
||
18 | :param Output output_object: The output object. |
||
19 | """ |
||
20 | CleoStyle.__init__(self, input_object, output_object) |
||
21 | |||
22 | # Create style notes. |
||
23 | 1 | output_object.get_formatter().add_style('note', 'yellow', None, ['bold']) |
|
24 | |||
25 | # Create style for file and directory names. |
||
26 | 1 | output_object.get_formatter().add_style('fso', 'white', None, ['bold']) |
|
27 | |||
28 | # ------------------------------------------------------------------------------------------------------------------ |
||
29 | 1 | def text(self, message: Union[str, list, None]) -> None: |
|
30 | if isinstance(message, list): |
||
31 | messages = message |
||
32 | 1 | else: |
|
33 | 1 | messages = [message] |
|
34 | |||
35 | for line in messages: |
||
36 | 1 | self.writeln(' {0}'.format(line)) |
|
37 | |||
39 |