2022.6 #88
@ -215,16 +215,11 @@ class Configuration(ConfigurationABC):
|
|||||||
|
|
||||||
# flags
|
# flags
|
||||||
elif isinstance(arg, FlagArgument):
|
elif isinstance(arg, FlagArgument):
|
||||||
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:
|
|
||||||
self._additional_arguments.append(arg.name)
|
self._additional_arguments.append(arg.name)
|
||||||
self._handled_args.append(arg_str)
|
self._handled_args.append(arg_str)
|
||||||
self._parse_arguments(executables, arg_list[i + 1:], arg.console_arguments)
|
self._parse_arguments(executables, arg_list[i + 1:], arg.console_arguments)
|
||||||
|
|
||||||
# add left over values to args
|
|
||||||
if arg_str not in self._additional_arguments and arg_str not in self._handled_args:
|
|
||||||
self._additional_arguments.append(arg_str)
|
|
||||||
|
|
||||||
def add_environment_variables(self, prefix: str):
|
def add_environment_variables(self, prefix: str):
|
||||||
for env_var in os.environ.keys():
|
for env_var in os.environ.keys():
|
||||||
if not env_var.startswith(prefix):
|
if not env_var.startswith(prefix):
|
||||||
@ -310,6 +305,10 @@ class Configuration(ConfigurationABC):
|
|||||||
arg_list = sys.argv[1:]
|
arg_list = sys.argv[1:]
|
||||||
executables: list[ExecutableArgument] = []
|
executables: list[ExecutableArgument] = []
|
||||||
self._parse_arguments(executables, arg_list, self._argument_types)
|
self._parse_arguments(executables, arg_list, self._argument_types)
|
||||||
|
for arg_str in arg_list:
|
||||||
|
# add left over values to args
|
||||||
|
if arg_str not in self._additional_arguments and arg_str not in self._handled_args:
|
||||||
|
self._additional_arguments.append(arg_str)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Console.error('An error occurred while parsing arguments.')
|
Console.error('An error occurred while parsing arguments.')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
Loading…
Reference in New Issue
Block a user