2021.4 #19
13
src/cpl_cli/command_abc.py
Normal file
13
src/cpl_cli/command_abc.py
Normal 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
|
@ -1,11 +1,11 @@
|
||||
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):
|
||||
ServiceABC.__init__(self)
|
||||
CommandABC.__init__(self)
|
||||
|
||||
def run(self, args: list[str]):
|
||||
Console.write_line('Available Commands:')
|
||||
|
@ -7,13 +7,13 @@ import pkg_resources
|
||||
import cpl
|
||||
import cpl_cli
|
||||
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):
|
||||
ServiceABC.__init__(self)
|
||||
CommandABC.__init__(self)
|
||||
|
||||
def run(self, args: list[str]):
|
||||
Console.set_foreground_color('yellow')
|
||||
|
Loading…
Reference in New Issue
Block a user