"shell" -> "sh", redundant SUBCOMMANDS array

This commit is contained in:
Jörn-Michael Miehe 2020-08-15 02:06:55 +02:00
parent a471ac4f51
commit 156318295f
3 changed files with 6 additions and 17 deletions

View file

@ -2,21 +2,9 @@
import logging import logging
# local # local
from . import subcommands
from .config import LoadedConfig from .config import LoadedConfig
from .parser import Parser from .parser import Parser
from .subcommands import *
###########
# CONSTANTS
# all available subcommands
SUBCOMMANDS = [
InitCommand,
ShowCommand,
LogsCommand,
CmdCommand,
ShellCommand
]
class Runner: class Runner:
@ -30,7 +18,8 @@ class Runner:
def __init__(self): def __init__(self):
# setup all subcommands # setup all subcommands
for cmd in SUBCOMMANDS: for className in subcommands.__all__:
cmd = getattr(subcommands, className)
self.__commands.append(cmd()) self.__commands.append(cmd())
def run(self): def run(self):

View file

@ -3,12 +3,12 @@ from .init import InitCommand
from .logs import LogsCommand from .logs import LogsCommand
from .show import ShowCommand from .show import ShowCommand
from .cmd import CmdCommand from .cmd import CmdCommand
from .shell import ShellCommand from .sh import ShCommand
__all__ = [ __all__ = [
'InitCommand', 'InitCommand',
'LogsCommand', 'LogsCommand',
'ShowCommand', 'ShowCommand',
'CmdCommand', 'CmdCommand',
'ShellCommand' 'ShCommand'
] ]

View file

@ -22,7 +22,7 @@ def _service_has_shell(config, args, compose_cmd, shell):
return False return False
class ShellCommand(ServiceCommand): class ShCommand(ServiceCommand):
def __init__(self): def __init__(self):
super().__init__( super().__init__(
'sh', 'sh',