2021.4.post1 #31

Merged
edraft merged 92 commits from 2021.4.post1 into master 2021-05-19 09:00:40 +02:00
Showing only changes of commit b1165e169a - Show all commits

View File

@ -157,10 +157,16 @@ class Configuration(ConfigurationABC):
if argument_type.token != '' and argument.startswith(argument_type.token): if argument_type.token != '' and argument.startswith(argument_type.token):
# --new=value # --new=value
if len(argument.split(argument_type.token)[1].split(argument_type.value_token)) == 0:
raise Exception(f'Expected argument for command: {argument}')
argument_name = argument.split(argument_type.token)[1].split(argument_type.value_token)[0] argument_name = argument.split(argument_type.token)[1].split(argument_type.value_token)[0]
else: else:
# new=value # new=value
argument_name = argument.split(argument_type.token)[1] argument_name = argument.split(argument_type.value_token)[1]
if argument_name == '':
raise Exception(f'Expected argument for command: {argument_type.name}')
result = True result = True
@ -199,7 +205,7 @@ class Configuration(ConfigurationABC):
if (next_arguments is None or len(next_arguments) == 0) and \ if (next_arguments is None or len(next_arguments) == 0) and \
argument_type.is_value_token_optional is not True: argument_type.is_value_token_optional is not True:
raise Exception(f'Invalid argument: {argument}') raise Exception(f'Expected argument for command: {argument_type.name}')
if (next_arguments is None or len(next_arguments) == 0) and argument_type.is_value_token_optional is True: if (next_arguments is None or len(next_arguments) == 0) and argument_type.is_value_token_optional is True:
value = '' value = ''
@ -277,6 +283,7 @@ class Configuration(ConfigurationABC):
if not found and error_message == '' and error is not False: if not found and error_message == '' and error is not False:
error_message = f'Invalid argument: {argument}' error_message = f'Invalid argument: {argument}'
if error_message != '':
if self._argument_error_function is not None: if self._argument_error_function is not None:
self._argument_error_function(error_message) self._argument_error_function(error_message)
else: else: