format
This commit is contained in:
parent
971e267943
commit
387b7406b5
4 changed files with 10 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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'
|
||||
]
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# system
|
||||
import logging
|
||||
|
||||
# local
|
||||
from ._subcommand import ProjectCommand
|
||||
from .utils.dockercommand import DockerCommand
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# system
|
||||
import logging
|
||||
|
||||
# local
|
||||
from ._subcommand import ServiceCommand
|
||||
from .utils.dockercommand import DockerCommand
|
||||
|
|
Loading…
Reference in a new issue