Improved commands

This commit is contained in:
Sven Heidemann 2021-03-04 17:36:02 +01:00
parent 266f9945f4
commit 956a107d38
3 changed files with 19 additions and 6 deletions

View File

@ -0,0 +1,13 @@
from abc import abstractmethod
from cpl.dependency_injection.service_abc import ServiceABC
class CommandABC(ServiceABC):
@abstractmethod
def __init__(self):
ServiceABC.__init__(self)
@abstractmethod
def run(self, args: list[str]): pass

View File

@ -1,11 +1,11 @@
from cpl.console.console import Console from cpl.console.console import Console
from cpl.dependency_injection.service_abc import ServiceABC from cpl_cli.command_abc import CommandABC
class Help(ServiceABC): class Help(CommandABC):
def __init__(self): def __init__(self):
ServiceABC.__init__(self) CommandABC.__init__(self)
def run(self, args: list[str]): def run(self, args: list[str]):
Console.write_line('Available Commands:') Console.write_line('Available Commands:')

View File

@ -7,13 +7,13 @@ import pkg_resources
import cpl import cpl
import cpl_cli import cpl_cli
from cpl.console.console import Console from cpl.console.console import Console
from cpl.dependency_injection.service_abc import ServiceABC from cpl_cli.command_abc import CommandABC
class Version(ServiceABC): class Version(CommandABC):
def __init__(self): def __init__(self):
ServiceABC.__init__(self) CommandABC.__init__(self)
def run(self, args: list[str]): def run(self, args: list[str]):
Console.set_foreground_color('yellow') Console.set_foreground_color('yellow')