Issues (60)

sdoc/command/BaseCommand.py (1 issue)

1 1
from abc import ABC
2
3 1
from cleo.commands.command import Command
4
5
6 1 View Code Duplication
class BaseCommand(Command, ABC):
0 ignored issues
show
This code seems to be duplicated in your project.
Loading history...
7
    """
8
    Abstract parent command for all out commands.
9
    """
10
11
    # ------------------------------------------------------------------------------------------------------------------
12 1
    def __set_style(self):
13
        """
14
        Sets the output format style used by SDoc.
15
        """
16
        # Style for file system objects (e.g. file and directory names).
17 1
        self.add_style('fso', fg='green', options=['bold'])
18
19
        # Style for errors.
20 1
        self.add_style('error', fg='red', options=['bold'])
21
22
        # Style for SDoc notices.
23 1
        self.add_style('notice', fg='yellow')
24
25
        # Style for titles.
26 1
        self.add_style('title', fg='yellow')
27
28
    # ------------------------------------------------------------------------------------------------------------------
29 1
    def _handle(self) -> int:
30
        """
31
        Executes this command.
32
        """
33
        raise NotImplementedError()
34
35
    # ------------------------------------------------------------------------------------------------------------------
36 1
    def handle(self) -> int:
37
        """
38
        Executes this command.
39
        """
40 1
        self.__set_style()
41
42 1
        return self._handle()
43
44
# ----------------------------------------------------------------------------------------------------------------------
45