Updated for merge options

This commit is contained in:
Dimitris Zlatanidis 2023-02-25 17:20:55 +02:00
parent ffdc974741
commit 453093d325

View file

@ -243,18 +243,19 @@ class Argparse(Configs):
self.file_pattern = arg.split('=')[1]
self.args[self.args.index(arg)] = self.flag_file_pattern
# Fixed for merge options if used, like: -iyjR
# Merge for options, like: -iyjR
for args in self.args:
if args.startswith('-') and len(args) > 2:
self.args.remove(args)
for arg in args[1:]:
if f'-{arg}' in self.commands.keys():
self.args.append(f'-{arg}')
for arg in list(map(lambda item: f'-{item}', list(args[1:]))):
if arg in self.commands.keys():
self.args.append(arg)
# Put command first and packages seconds.
self.args.reverse()
continue
self.flags.append(f'-{arg}')
self.flags.append(arg)
# Move options to flags
for opt in self.options:
if opt in self.args:
self.args.remove(opt)