Skip to content

AppendCommandsCliService

AppendCommandsCliService

Bases: ServiceInterface

Append commands to execute in CLI.

Source code in myalias/core/services/append_commands_cli_service.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class AppendCommandsCliService(ServiceInterface):
    """Append commands to execute in CLI."""

    def execute(self, app: typer.Typer):
        """
        Append commands in CLI.

        Args:
            app (typer.Typer): Typer app.

        Returns:
            None
        """
        commands = GetAllCommandsService().execute()

        for command in commands:
            app.command(name=command['name'], help=command['description'])(
                command['instance']().execute
            ),

execute(app)

Append commands in CLI.

Parameters:

Name Type Description Default
app typer.Typer

Typer app.

required

Returns:

Type Description

None

Source code in myalias/core/services/append_commands_cli_service.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def execute(self, app: typer.Typer):
    """
    Append commands in CLI.

    Args:
        app (typer.Typer): Typer app.

    Returns:
        None
    """
    commands = GetAllCommandsService().execute()

    for command in commands:
        app.command(name=command['name'], help=command['description'])(
            command['instance']().execute
        ),