diff --git a/src/kiwi/runner.py b/src/kiwi/runner.py index f772372..b62cbd9 100644 --- a/src/kiwi/runner.py +++ b/src/kiwi/runner.py @@ -2,21 +2,9 @@ import logging # local +from . import subcommands from .config import LoadedConfig from .parser import Parser -from .subcommands import * - -########### -# CONSTANTS - -# all available subcommands -SUBCOMMANDS = [ - InitCommand, - ShowCommand, - LogsCommand, - CmdCommand, - ShellCommand -] class Runner: @@ -30,7 +18,8 @@ class Runner: def __init__(self): # setup all subcommands - for cmd in SUBCOMMANDS: + for className in subcommands.__all__: + cmd = getattr(subcommands, className) self.__commands.append(cmd()) def run(self): diff --git a/src/kiwi/subcommands/__init__.py b/src/kiwi/subcommands/__init__.py index 9b026d7..7cef98e 100644 --- a/src/kiwi/subcommands/__init__.py +++ b/src/kiwi/subcommands/__init__.py @@ -3,12 +3,12 @@ from .init import InitCommand from .logs import LogsCommand from .show import ShowCommand from .cmd import CmdCommand -from .shell import ShellCommand +from .sh import ShCommand __all__ = [ 'InitCommand', 'LogsCommand', 'ShowCommand', 'CmdCommand', - 'ShellCommand' + 'ShCommand' ] diff --git a/src/kiwi/subcommands/shell.py b/src/kiwi/subcommands/sh.py similarity index 97% rename from src/kiwi/subcommands/shell.py rename to src/kiwi/subcommands/sh.py index 7967b3e..00f5d48 100644 --- a/src/kiwi/subcommands/shell.py +++ b/src/kiwi/subcommands/sh.py @@ -22,7 +22,7 @@ def _service_has_shell(config, args, compose_cmd, shell): return False -class ShellCommand(ServiceCommand): +class ShCommand(ServiceCommand): def __init__(self): super().__init__( 'sh',