Dev build & migrated custom scripts & add logic to prevent next executable
This commit is contained in:
@@ -15,7 +15,7 @@ __title__ = 'cpl_core.configuration'
|
||||
__author__ = 'Sven Heidemann'
|
||||
__license__ = 'MIT'
|
||||
__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de'
|
||||
__version__ = '2022.6.3.dev3'
|
||||
__version__ = '2022.6.3.dev4'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
@@ -33,4 +33,4 @@ from .flag_argument import FlagArgument
|
||||
from .variable_argument import VariableArgument
|
||||
|
||||
VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
||||
version_info = VersionInfo(major='2022', minor='6', micro='3.dev3')
|
||||
version_info = VersionInfo(major='2022', minor='6', micro='3.dev4')
|
||||
|
@@ -10,6 +10,7 @@ class ArgumentABC(ABC):
|
||||
token: str,
|
||||
name: str,
|
||||
aliases: list[str],
|
||||
prevent_next_executable: bool = False,
|
||||
console_arguments: list['ArgumentABC'] = None
|
||||
):
|
||||
r"""Representation of an console argument
|
||||
@@ -24,6 +25,7 @@ class ArgumentABC(ABC):
|
||||
self._token = token
|
||||
self._name = name
|
||||
self._aliases = aliases
|
||||
self._prevent_next_executable = prevent_next_executable
|
||||
self._console_arguments = console_arguments if console_arguments is not None else []
|
||||
|
||||
@property
|
||||
@@ -38,6 +40,10 @@ class ArgumentABC(ABC):
|
||||
def aliases(self) -> list[str]:
|
||||
return self._aliases
|
||||
|
||||
@property
|
||||
def prevent_next_executable(self) -> bool:
|
||||
return self._prevent_next_executable
|
||||
|
||||
@property
|
||||
def console_arguments(self) -> list['ArgumentABC']:
|
||||
return self._console_arguments
|
||||
|
@@ -240,7 +240,7 @@ class Configuration(ConfigurationABC):
|
||||
configuration.from_dict(value)
|
||||
self.add_configuration(sub, configuration)
|
||||
|
||||
def add_configuration(self, key_type: Union[str, type], value: ConfigurationModelABC):
|
||||
def add_configuration(self, key_type: Union[str, type], value: Union[str, ConfigurationModelABC]):
|
||||
self._config[key_type] = value
|
||||
|
||||
def create_console_argument(self, arg_type: ArgumentTypeEnum, token: str, name: str, aliases: list[str],
|
||||
@@ -281,6 +281,11 @@ class Configuration(ConfigurationABC):
|
||||
executables: list[ExecutableArgument] = []
|
||||
self._parse_arguments(executables, arg_list, self._argument_types)
|
||||
|
||||
prevent = False
|
||||
for exe in executables:
|
||||
if prevent:
|
||||
continue
|
||||
cmd: CommandABC = services.get_service(exe.executable_type)
|
||||
self.add_configuration('ACTIVE_EXECUTABLE', exe.name)
|
||||
cmd.execute(self._additional_arguments)
|
||||
prevent = exe.prevent_next_executable
|
||||
|
Reference in New Issue
Block a user