Improved help command

This commit is contained in:
2022-05-19 20:21:46 +02:00
parent 0d37c86061
commit 94c82e6701
5 changed files with 37 additions and 52 deletions

View File

@@ -1,6 +1,7 @@
from abc import abstractmethod, ABC
from cpl_core.configuration.executable_argument import ExecutableArgument
from cpl_core.console import Console
class CommandABC(ExecutableArgument):
@@ -12,3 +13,14 @@ class CommandABC(ExecutableArgument):
@property
@abstractmethod
def help_message(self) -> str: pass
def execute(self, args: list[str]):
Console.write_line(args)
if 'help' in args:
Console.write_line(self.help_message)
return
self.run(args)
@abstractmethod
def run(self, args: list[str]): pass