This commit is contained in:
Sven Heidemann 2021-03-13 22:03:24 +01:00
parent 534982b18d
commit 0522467b76

View File

@ -103,41 +103,50 @@ class Configuration(ConfigurationABC):
if argument_type.value_token != '' and argument_type.value_token in argument: if argument_type.value_token != '' and argument_type.value_token in argument:
# ?new=value # ?new=value
if argument_type.is_value_token_optional is not None and argument_type.is_value_token_optional:
self._additional_arguments.append(argument_type.name)
result = True
if argument_type.token != '' and argument.startswith(argument_type.token): if not result:
# --new=value if argument_type.token != '' and argument.startswith(argument_type.token):
argument_name = argument.split(argument_type.token)[1].split(argument_type.value_token)[0] # --new=value
value = argument.split(argument_type.token)[1].split(argument_type.value_token)[1] argument_name = argument.split(argument_type.token)[1].split(argument_type.value_token)[0]
else: value = argument.split(argument_type.token)[1].split(argument_type.value_token)[1]
# new=value else:
argument_name = argument.split(argument_type.token)[1] # new=value
value = argument.split(argument_type.token)[1].split(argument_type.value_token)[1] argument_name = argument.split(argument_type.token)[1]
value = argument.split(argument_type.token)[1].split(argument_type.value_token)[1]
if argument_name != argument_type.name and argument_name not in argument_type.aliases: if argument_name != argument_type.name and argument_name not in argument_type.aliases:
return False return False
self._set_variable(argument_type.name, value) self._set_variable(argument_type.name, value)
result = True result = True
elif argument_type.value_token == ' ': elif argument_type.value_token == ' ':
# ?new value # ?new value
if next_arguments is None or len(next_arguments) == 0: if argument_type.is_value_token_optional is not None and argument_type.is_value_token_optional:
raise Exception(f'Invalid argument: {argument}') self._additional_arguments.append(argument_type.name)
result = True
value = next_arguments[0] if not result:
if next_arguments is None or len(next_arguments) == 0:
raise Exception(f'Invalid argument: {argument}')
if argument_type.token != '' and argument.startswith(argument_type.token): value = next_arguments[0]
# --new value
argument_name = argument.split(argument_type.token)[1]
else:
# new value
argument_name = argument
if argument_name != argument_type.name and argument_name not in argument_type.aliases: if argument_type.token != '' and argument.startswith(argument_type.token):
return False # --new value
argument_name = argument.split(argument_type.token)[1]
else:
# new value
argument_name = argument
self._set_variable(argument_type.name, value) if argument_name != argument_type.name and argument_name not in argument_type.aliases:
result = True return False
self._set_variable(argument_type.name, value)
result = True
elif argument_type.name == argument or argument in argument_type.aliases: elif argument_type.name == argument or argument in argument_type.aliases:
# new # new