Improved command handling
This commit is contained in:
parent
69211cc9e8
commit
2c43e55f77
@ -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
|
|
23
src/cpl_cli/command_model.py
Normal file
23
src/cpl_cli/command_model.py
Normal 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
|
Loading…
Reference in New Issue
Block a user