cpl@2022.6.3 - Verbesserung der Parameter #67

Merged
edraft merged 25 commits from 2022.6.3 into 2022.6 2022-05-22 17:38:22 +02:00
2 changed files with 0 additions and 11 deletions
Showing only changes of commit a495532a4d - Show all commits

View File

@ -159,9 +159,7 @@ class Configuration(ConfigurationABC):
def _parse_arguments(self, call_stack: list[Callable], arg_list: list[str], args_types: list[ArgumentABC]): def _parse_arguments(self, call_stack: list[Callable], arg_list: list[str], args_types: list[ArgumentABC]):
for i in range(0, len(arg_list)): for i in range(0, len(arg_list)):
arg_str = arg_list[i] arg_str = arg_list[i]
Console.write_line('ARG_STR', arg_str)
for arg in args_types: for arg in args_types:
Console.write_line('ARG', arg.name, type(arg), len(arg.console_arguments))
arg_str_without_token = arg_str arg_str_without_token = arg_str
if arg.token != "" and arg.token in arg_str: if arg.token != "" and arg.token in arg_str:
arg_str_without_token = arg_str.split(arg.token)[1] arg_str_without_token = arg_str.split(arg.token)[1]
@ -170,7 +168,6 @@ class Configuration(ConfigurationABC):
if isinstance(arg, ExecutableArgument): if isinstance(arg, ExecutableArgument):
if arg_str.startswith(arg.token) \ if arg_str.startswith(arg.token) \
and arg_str_without_token == arg.name or arg_str_without_token in arg.aliases: and arg_str_without_token == arg.name or arg_str_without_token in arg.aliases:
Console.write_line('EXEC', arg.name)
call_stack.append(arg.run) call_stack.append(arg.run)
self._parse_arguments(call_stack, arg_list[i:], arg.console_arguments) self._parse_arguments(call_stack, arg_list[i:], arg.console_arguments)
@ -195,22 +192,16 @@ class Configuration(ConfigurationABC):
self._additional_arguments.append(arg.name) self._additional_arguments.append(arg.name)
self._parse_arguments(call_stack, arg_list[i + 1:], arg.console_arguments) self._parse_arguments(call_stack, arg_list[i + 1:], arg.console_arguments)
Console.write_line()
def parse_console_arguments(self, error: bool = None): def parse_console_arguments(self, error: bool = None):
# sets environment variables as possible arguments as: --VAR=VALUE # sets environment variables as possible arguments as: --VAR=VALUE
for arg_name in ConfigurationVariableNameEnum.to_list(): for arg_name in ConfigurationVariableNameEnum.to_list():
self.add_console_argument(VariableArgument('--', str(arg_name).upper(), [str(arg_name).lower()], '=')) self.add_console_argument(VariableArgument('--', str(arg_name).upper(), [str(arg_name).lower()], '='))
Console.error('Parsing arguments:')
arg_list = sys.argv[1:] arg_list = sys.argv[1:]
call_stack = [] call_stack = []
self._parse_arguments(call_stack, arg_list, self._argument_types) self._parse_arguments(call_stack, arg_list, self._argument_types)
Console.error('Parsing finished')
for call in call_stack: for call in call_stack:
Console.write_line(call)
call(self._additional_arguments) call(self._additional_arguments)
def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None): def add_json_file(self, name: str, optional: bool = None, output: bool = True, path: str = None):

View File

@ -13,6 +13,4 @@ class GenerateArgument(ArgumentExecutableABC):
def run(self, args: list[str]): def run(self, args: list[str]):
Console.error('Generate:') Console.error('Generate:')
for c in self._config._config:
Console.write_line(c, self._config.get_configuration(c))
Console.write_line(args, self._env.environment_name) Console.write_line(args, self._env.environment_name)