2021-03-04 19:06:37 +01:00
|
|
|
from collections import Callable
|
|
|
|
|
|
|
|
from cpl_cli.command_abc import CommandABC
|
|
|
|
|
|
|
|
|
|
|
|
class CommandModel:
|
|
|
|
|
2021-04-11 13:00:26 +02:00
|
|
|
def __init__(self, name: str, aliases: list[str], command: Callable[CommandABC], is_workspace_needed: bool,
|
|
|
|
is_project_needed: bool, change_cwd: bool):
|
2021-03-04 19:06:37 +01:00
|
|
|
self._name = name
|
|
|
|
self._aliases = aliases
|
|
|
|
self._command = command
|
2021-04-11 13:00:26 +02:00
|
|
|
self._is_workspace_needed = is_workspace_needed
|
2021-03-08 22:29:28 +01:00
|
|
|
self._is_project_needed = is_project_needed
|
2021-04-11 11:12:39 +02:00
|
|
|
self._change_cwd = change_cwd
|
2021-03-04 19:06:37 +01:00
|
|
|
|
|
|
|
@property
|
|
|
|
def name(self) -> str:
|
|
|
|
return self._name
|
|
|
|
|
|
|
|
@property
|
|
|
|
def aliases(self) -> list[str]:
|
|
|
|
return self._aliases
|
2021-04-11 11:12:39 +02:00
|
|
|
|
2021-03-04 19:06:37 +01:00
|
|
|
@property
|
|
|
|
def command(self) -> Callable[CommandABC]:
|
|
|
|
return self._command
|
2021-04-11 13:00:26 +02:00
|
|
|
|
|
|
|
@property
|
|
|
|
def is_workspace_needed(self) -> bool:
|
|
|
|
return self._is_workspace_needed
|
2021-04-11 11:12:39 +02:00
|
|
|
|
2021-03-08 22:29:28 +01:00
|
|
|
@property
|
|
|
|
def is_project_needed(self) -> bool:
|
|
|
|
return self._is_project_needed
|
2021-04-11 11:12:39 +02:00
|
|
|
|
|
|
|
@property
|
|
|
|
def change_cwd(self) -> bool:
|
|
|
|
return self._change_cwd
|