diff --git a/src/kiwi/runner.py b/src/kiwi/runner.py index b62cbd9..f18bdb4 100644 --- a/src/kiwi/runner.py +++ b/src/kiwi/runner.py @@ -22,13 +22,16 @@ class Runner: cmd = getattr(subcommands, className) self.__commands.append(cmd()) - def run(self): + def run(self, command=None): """run the desired subcommand""" args = Parser().get_args() + if command is None: + command = args.command + for cmd in self.__commands: - if str(cmd) == args.command: + if str(cmd) == command: # command found logging.debug(f"Running '{cmd}' with args: {args}") @@ -42,7 +45,7 @@ class Runner: return True # command not found - logging.error(f"kiwi command '{args.command}' unknown") + logging.error(f"kiwi command '{command}' unknown") return False __instance = None diff --git a/src/kiwi/subcommands/__init__.py b/src/kiwi/subcommands/__init__.py index 7cef98e..e582594 100644 --- a/src/kiwi/subcommands/__init__.py +++ b/src/kiwi/subcommands/__init__.py @@ -1,14 +1,14 @@ # local +from .cmd import CmdCommand from .init import InitCommand from .logs import LogsCommand -from .show import ShowCommand -from .cmd import CmdCommand from .sh import ShCommand +from .show import ShowCommand __all__ = [ + 'CmdCommand', 'InitCommand', 'LogsCommand', + 'ShCommand', 'ShowCommand', - 'CmdCommand', - 'ShCommand' ] diff --git a/src/kiwi/subcommands/cmd.py b/src/kiwi/subcommands/cmd.py index 56cd5f4..d89f6f8 100644 --- a/src/kiwi/subcommands/cmd.py +++ b/src/kiwi/subcommands/cmd.py @@ -1,6 +1,3 @@ -# system -import logging - # local from ._subcommand import ProjectCommand from .utils.dockercommand import DockerCommand diff --git a/src/kiwi/subcommands/logs.py b/src/kiwi/subcommands/logs.py index a704de2..b63bc21 100644 --- a/src/kiwi/subcommands/logs.py +++ b/src/kiwi/subcommands/logs.py @@ -1,6 +1,3 @@ -# system -import logging - # local from ._subcommand import ServiceCommand from .utils.dockercommand import DockerCommand