From cfb6a847996bb90279fbb991b3febbad92e6c50f Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 11 Apr 2021 14:44:46 +0200 Subject: [PATCH] Fixed console argument handling --- src/cpl/configuration/configuration.py | 9 ++++++--- src/cpl_cli/command/generate_service.py | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cpl/configuration/configuration.py b/src/cpl/configuration/configuration.py index d5c2e714..c74872db 100644 --- a/src/cpl/configuration/configuration.py +++ b/src/cpl/configuration/configuration.py @@ -120,6 +120,9 @@ class Configuration(ConfigurationABC): if found and child_argument_type.name not in self._additional_arguments: self._additional_arguments.append(child_argument_type.name) + if found: + break + if not found: raise Exception(f'Invalid argument: {argument}') @@ -197,8 +200,7 @@ class Configuration(ConfigurationABC): # ?new value found = False for alias in argument_type.aliases: - alias = f' {alias} ' - if alias in argument: + if alias == argument or f' {alias} ' == argument: found = True if argument_type.name not in argument and not found: @@ -212,6 +214,7 @@ class Configuration(ConfigurationABC): value = '' else: value = next_arguments[0] + next_arguments.remove(value) self._handled_args.append(value) if argument_type.token != '' and argument.startswith(argument_type.token): @@ -237,7 +240,7 @@ class Configuration(ConfigurationABC): self._additional_arguments.append(argument_type.name) result = True - if result and value == '': + if result: self._handled_args.append(argument) if next_arguments is not None and len(next_arguments) > 0: next_args = [] diff --git a/src/cpl_cli/command/generate_service.py b/src/cpl_cli/command/generate_service.py index 770ae406..3358d681 100644 --- a/src/cpl_cli/command/generate_service.py +++ b/src/cpl_cli/command/generate_service.py @@ -102,8 +102,6 @@ class GenerateService(CommandABC): rel_path = '/'.join(parts[:-1]) class_name = parts[len(parts) - 1] - Console.write_line(rel_path) - if 'src' not in rel_path: rel_path = f'src/{rel_path}'