Fixed for doubles options

This commit is contained in:
Dimitris Zlatanidis 2023-03-17 11:16:17 +02:00
parent 7000139f9f
commit 97698c5631

View file

@ -270,6 +270,7 @@ class Argparse(Configs):
""" Checks for invalid options. """
invalid: list = []
commands: list = []
doubles: list = []
for arg in self.args:
if arg[0] == '-' and arg in self.commands.keys():
@ -278,6 +279,14 @@ class Argparse(Configs):
invalid.append(arg)
elif arg[0] == '--' and arg not in self.options:
invalid.append(arg)
elif arg[0] == '-' and arg in self.options:
doubles.append(arg)
# Fixed for doubles options.
if doubles:
for opt in doubles:
print(f"{self.prog_name}: invalid double option '{opt}'")
self.usage.help_minimal()
# Fixed for invalid commands combination.
if len(commands) > 1: