Updated for options checks

This commit is contained in:
Dimitris Zlatanidis 2023-03-15 22:53:40 +02:00
parent 2bfa08572f
commit afc6833512
2 changed files with 7 additions and 0 deletions

View file

@ -1,6 +1,7 @@
4.6.1 - 15/03/2023
Updated:
- For None args
- Checks for options
Updated:
- Dialog text help for dependencies

View file

@ -273,6 +273,7 @@ class Argparse(Configs):
Puts the command first and options after.
Result: ['-i', '-y', '-j', '-R']
"""
invalid_options: list = []
for args in self.args:
if args[0] == '-' and args[:2] != '--' and len(args) >= 3 and '=' not in args:
self.args.remove(args)
@ -281,9 +282,14 @@ class Argparse(Configs):
if opt in self.commands.keys():
self.args.insert(0, opt)
continue
elif opt not in self.options:
invalid_options.append(opt)
self.args.append(opt)
if invalid_options:
self.usage.help_short()
def split_options_from_args(self) -> None:
""" Split options from arguments.