mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
Fixed for split options
This commit is contained in:
parent
00822ba1c7
commit
dd22cfb0f1
1 changed files with 18 additions and 23 deletions
|
@ -222,12 +222,27 @@ class Argparse(Configs):
|
|||
self.commands['-e'] = self.commands['dependees']
|
||||
self.commands['-t'] = self.commands['tracking']
|
||||
|
||||
self.remove_flags()
|
||||
self.split_options()
|
||||
self.split_options_from_args()
|
||||
self.move_options()
|
||||
|
||||
def remove_flags(self):
|
||||
""" Split options with arguments. """
|
||||
def split_options(self):
|
||||
""" Split options and commands, like: -iyjR """
|
||||
for args in self.args:
|
||||
if (args[0] == '-' and args[:2] != '--' and len(args) >= 3 and
|
||||
not args.startswith((self.flag_short_file_pattern,
|
||||
self.flag_short_directory))):
|
||||
self.args.remove(args)
|
||||
|
||||
for opt in list(map(lambda item: f'-{item}', [arg for arg in list(args[1:])])):
|
||||
if opt in self.commands.keys():
|
||||
self.args.insert(0, opt)
|
||||
continue
|
||||
|
||||
self.args.append(opt)
|
||||
|
||||
def split_options_from_args(self):
|
||||
""" Split options from arguments. """
|
||||
for arg in self.args:
|
||||
if arg.startswith(self.flag_directory):
|
||||
self.directory = arg.split('=')[1]
|
||||
|
@ -252,26 +267,6 @@ class Argparse(Configs):
|
|||
self.args.remove(opt)
|
||||
self.flags.append(opt)
|
||||
|
||||
def split_options(self):
|
||||
""" Split options and commands, like: -iyjR """
|
||||
for args in self.args:
|
||||
|
||||
if args.startswith('-') and len(args) > 2:
|
||||
if not args.startswith('--') and args not in [self.flag_short_file_pattern,
|
||||
self.flag_short_directory]:
|
||||
self.args.remove(args)
|
||||
for arg in args[1:]:
|
||||
|
||||
flag = f'-{arg}'
|
||||
|
||||
if flag in self.commands.keys():
|
||||
self.args.append(flag)
|
||||
# Put command first and packages seconds.
|
||||
self.args.reverse()
|
||||
continue
|
||||
|
||||
self.flags.append(flag)
|
||||
|
||||
def is_dialog_enabled(self):
|
||||
""" Checking if the dialog box is enabled. """
|
||||
if (not self.dialogbox and self.utils.is_option(self.flag_searches, self.flags) or
|
||||
|
|
Loading…
Reference in a new issue