mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Updated for invalid combination
This commit is contained in:
parent
29e6b4f08b
commit
5170a7a446
1 changed files with 6 additions and 5 deletions
|
@ -269,19 +269,20 @@ class Argparse(Configs):
|
|||
def invalid_options(self):
|
||||
""" Checks for invalid options. """
|
||||
invalid: list = []
|
||||
command: list = []
|
||||
commands: list = []
|
||||
|
||||
for arg in self.args:
|
||||
if arg[0] == '-' and arg in self.commands.keys():
|
||||
command.append(arg)
|
||||
commands.append(arg)
|
||||
elif arg[0] == '-' and arg not in self.options:
|
||||
invalid.append(arg)
|
||||
elif arg[0] == '--' and arg not in self.options:
|
||||
invalid.append(arg)
|
||||
|
||||
# Fixed for two or more commands.
|
||||
if len(command) > 1:
|
||||
invalid = command
|
||||
# Fixed for invalid commands combination.
|
||||
if len(commands) > 1:
|
||||
print(f"{self.prog_name}: invalid combination '{', '.join(commands)}'")
|
||||
self.usage.help_minimal()
|
||||
|
||||
# Prints error for invalid options.
|
||||
if invalid:
|
||||
|
|
Loading…
Add table
Reference in a new issue