Improved command handling

This commit is contained in:
Sven Heidemann 2021-03-04 19:06:37 +01:00
parent 69211cc9e8
commit 2c43e55f77
2 changed files with 23 additions and 21 deletions

View File

@ -1,21 +0,0 @@
from cpl.dependency_injection.service_abc import ServiceABC
class Command:
def __init__(self, name: str, aliases: list[str], command: ServiceABC):
self._name = name
self._aliases = aliases
self._command = command
@property
def name(self):
return self._name
@property
def aliases(self):
return self._aliases
@property
def command(self):
return self._command

View File

@ -0,0 +1,23 @@
from collections import Callable
from cpl_cli.command_abc import CommandABC
class CommandModel:
def __init__(self, name: str, aliases: list[str], command: Callable[CommandABC]):
self._name = name
self._aliases = aliases
self._command = command
@property
def name(self) -> str:
return self._name
@property
def aliases(self) -> list[str]:
return self._aliases
@property
def command(self) -> Callable[CommandABC]:
return self._command