Added logic to add CLI commands from external packages

This commit is contained in:
2022-05-22 18:32:34 +02:00
parent d11c56db03
commit dec4a45d98
8 changed files with 114 additions and 57 deletions

View File

@@ -1,10 +1,10 @@
from abc import abstractmethod, ABC
from cpl_core.configuration.executable_argument import ExecutableArgument
from cpl_core.configuration.argument_executable_abc import ArgumentExecutableABC
from cpl_core.console import Console
class CommandABC(ExecutableArgument):
class CommandABC(ArgumentExecutableABC):
@abstractmethod
def __init__(self):
@@ -14,12 +14,12 @@ class CommandABC(ExecutableArgument):
@abstractmethod
def help_message(self) -> str: pass
def execute(self, args: list[str]):
@abstractmethod
def execute(self, args: list[str]): pass
def run(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
self.execute(args)