This commit is contained in:
Jörn-Michael Miehe 2020-08-17 10:55:08 +02:00
parent 971e267943
commit 387b7406b5
4 changed files with 10 additions and 13 deletions

View file

@ -22,13 +22,16 @@ class Runner:
cmd = getattr(subcommands, className) cmd = getattr(subcommands, className)
self.__commands.append(cmd()) self.__commands.append(cmd())
def run(self): def run(self, command=None):
"""run the desired subcommand""" """run the desired subcommand"""
args = Parser().get_args() args = Parser().get_args()
if command is None:
command = args.command
for cmd in self.__commands: for cmd in self.__commands:
if str(cmd) == args.command: if str(cmd) == command:
# command found # command found
logging.debug(f"Running '{cmd}' with args: {args}") logging.debug(f"Running '{cmd}' with args: {args}")
@ -42,7 +45,7 @@ class Runner:
return True return True
# command not found # command not found
logging.error(f"kiwi command '{args.command}' unknown") logging.error(f"kiwi command '{command}' unknown")
return False return False
__instance = None __instance = None

View file

@ -1,14 +1,14 @@
# local # local
from .cmd import CmdCommand
from .init import InitCommand from .init import InitCommand
from .logs import LogsCommand from .logs import LogsCommand
from .show import ShowCommand
from .cmd import CmdCommand
from .sh import ShCommand from .sh import ShCommand
from .show import ShowCommand
__all__ = [ __all__ = [
'CmdCommand',
'InitCommand', 'InitCommand',
'LogsCommand', 'LogsCommand',
'ShCommand',
'ShowCommand', 'ShowCommand',
'CmdCommand',
'ShCommand'
] ]

View file

@ -1,6 +1,3 @@
# system
import logging
# local # local
from ._subcommand import ProjectCommand from ._subcommand import ProjectCommand
from .utils.dockercommand import DockerCommand from .utils.dockercommand import DockerCommand

View file

@ -1,6 +1,3 @@
# system
import logging
# local # local
from ._subcommand import ServiceCommand from ._subcommand import ServiceCommand
from .utils.dockercommand import DockerCommand from .utils.dockercommand import DockerCommand