2021-03-29 13:29:26 +02:00
|
|
|
from abc import abstractmethod, ABC
|
2021-03-04 17:36:02 +01:00
|
|
|
|
2022-05-19 08:25:32 +02:00
|
|
|
from cpl_core.configuration.executable_argument import ExecutableArgument
|
2022-05-19 20:21:46 +02:00
|
|
|
from cpl_core.console import Console
|
2021-03-04 17:36:02 +01:00
|
|
|
|
2022-05-19 08:25:32 +02:00
|
|
|
|
|
|
|
class CommandABC(ExecutableArgument):
|
2021-03-04 17:36:02 +01:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def __init__(self):
|
2021-03-29 13:29:26 +02:00
|
|
|
ABC.__init__(self)
|
2021-03-04 17:36:02 +01:00
|
|
|
|
2021-04-11 16:36:59 +02:00
|
|
|
@property
|
|
|
|
@abstractmethod
|
|
|
|
def help_message(self) -> str: pass
|
2022-05-19 20:21:46 +02:00
|
|
|
|
|
|
|
def execute(self, args: list[str]):
|
|
|
|
if 'help' in args:
|
|
|
|
Console.write_line(self.help_message)
|
|
|
|
return
|
|
|
|
|
|
|
|
self.run(args)
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def run(self, args: list[str]): pass
|