Split to methods

This commit is contained in:
Dimitris Zlatanidis 2023-02-25 20:21:37 +02:00
parent c5b3341cad
commit 916f775b23

View file

@ -223,6 +223,8 @@ class Argparse(Configs):
self.commands['-t'] = self.commands['tracking']
self.remove_flags()
self.split_options()
self.move_options()
def remove_flags(self):
""" Remove flags from args. """
@ -243,7 +245,15 @@ class Argparse(Configs):
self.file_pattern = arg.split('=')[1]
self.args[self.args.index(arg)] = self.flag_short_file_pattern
# Merge options if used, like: -iyjR
def move_options(self):
""" Move options to the flags. """
for opt in self.options:
if opt in self.args:
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,
@ -258,12 +268,6 @@ class Argparse(Configs):
continue
self.flags.append(flag)
# Move options to the flags
for opt in self.options:
if opt in self.args:
self.args.remove(opt)
self.flags.append(opt)
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