mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +01:00
Split to methods
This commit is contained in:
parent
c5b3341cad
commit
916f775b23
1 changed files with 11 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue