mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-27 09:58:10 +01:00
Updated for merge options
This commit is contained in:
parent
453093d325
commit
51139f5b3d
6 changed files with 28 additions and 25 deletions
|
@ -17,8 +17,8 @@ class Dependees(Configs, Utilities):
|
|||
super(Utilities, self).__init__()
|
||||
self.packages = packages
|
||||
self.flags = flags
|
||||
self.flag_full_reverse = ['-fr', '--full-reverse']
|
||||
self.flag_pkg_version = ['-pv', '--pkg-version']
|
||||
self.flag_full_reverse = ['-E', '--full-reverse']
|
||||
self.flag_pkg_version = ['-p', '--pkg-version']
|
||||
self.session = Session
|
||||
self.ascii = Ascii()
|
||||
self.llc = self.ascii.lower_left_corner
|
||||
|
|
|
@ -49,7 +49,7 @@ class Argparse(Configs):
|
|||
self.flag_jobs = '--jobs'
|
||||
self.flag_short_jobs = '-j'
|
||||
self.flag_resolve_off = '--resolve-off'
|
||||
self.flag_short_resolve_off = '-L'
|
||||
self.flag_short_resolve_off = '-l'
|
||||
self.flag_reinstall = '--reinstall'
|
||||
self.flag_short_reinstall = '-R'
|
||||
self.flag_skip_installed = '--skip-installed'
|
||||
|
@ -233,7 +233,7 @@ class Argparse(Configs):
|
|||
|
||||
if arg.startswith(self.flag_short_directory):
|
||||
self.directory = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_directory
|
||||
self.args[self.args.index(arg)] = self.flag_short_directory
|
||||
|
||||
if arg.startswith(self.flag_file_pattern):
|
||||
self.file_pattern = arg.split('=')[1]
|
||||
|
@ -241,21 +241,24 @@ class Argparse(Configs):
|
|||
|
||||
if arg.startswith(self.flag_short_file_pattern):
|
||||
self.file_pattern = arg.split('=')[1]
|
||||
self.args[self.args.index(arg)] = self.flag_file_pattern
|
||||
self.args[self.args.index(arg)] = self.flag_short_file_pattern
|
||||
|
||||
# Merge for options, like: -iyjR
|
||||
# Merge options if used, like: -iyjR
|
||||
for args in self.args:
|
||||
if args.startswith('-') and len(args) > 2:
|
||||
self.args.remove(args)
|
||||
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(arg)
|
||||
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)
|
||||
|
||||
# Move options to flags
|
||||
# Move options to the flags
|
||||
for opt in self.options:
|
||||
if opt in self.args:
|
||||
self.args.remove(opt)
|
||||
|
|
|
@ -32,7 +32,7 @@ class RemovePackages(Configs):
|
|||
self.dependencies = []
|
||||
self.utils = Utilities()
|
||||
self.progress = ProgressBar()
|
||||
self.flag_resolve_off = ['-L', '--resolve-off']
|
||||
self.flag_resolve_off = ['-l', '--resolve-off']
|
||||
self.flag_no_silent = ['-o', '--no-silent']
|
||||
self.output = 0
|
||||
self.remove_pkg = None
|
||||
|
|
|
@ -53,7 +53,7 @@ class Slackbuilds(Configs):
|
|||
self.bred = f'{self.bold}{self.red}'
|
||||
self.flag_reinstall = ['-R', '--reinstall']
|
||||
self.flag_skip_installed = ['-k', '--skip-installed']
|
||||
self.flag_resolve_off = ['-L', '--resolve-off']
|
||||
self.flag_resolve_off = ['-l', '--resolve-off']
|
||||
self.flag_jobs = ['-j', '--jobs']
|
||||
self.flag_no_silent = ['-o', '--no-silent']
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class Usage(Configs):
|
|||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-b, build, -i, install, -d, download, -r, remove] <packages>\n'
|
||||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-f, find, -w, view, -s, search] <packages>\n'
|
||||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-e, dependees, -t, tracking] <packages>\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-y, --yes, -j, --jobs, -L, --resolve-off, -R, --reinstall]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-y, --yes, -j, --jobs, -l, --resolve-off, -R, --reinstall]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-k, --skip-installed, -E, --full-reverse, -S, --search]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-o, --no-silent, -p, --pkg-version]\n'
|
||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-e, --directory=PATH, -F, --file-pattern=PATTERN]\n'
|
||||
|
@ -59,15 +59,15 @@ class Usage(Configs):
|
|||
f'\n{self.bold}OPTIONS:{self.endc}\n'
|
||||
f' {self.yellow}-y, --yes{self.endc} Answer Yes to all questions.\n'
|
||||
f' {self.yellow}-j, --jobs{self.endc} Set it for multicore systems.\n'
|
||||
f' {self.yellow}-L, --resolve-off{self.endc} Turns off dependency resolving.\n'
|
||||
f' {self.yellow}-l, --resolve-off{self.endc} Turns off dependency resolving.\n'
|
||||
f' {self.yellow}-R, --reinstall{self.endc} Upgrade packages of the same version.\n'
|
||||
f' {self.yellow}-k, --skip-installed{self.endc} Skip installed packages.\n'
|
||||
f' {self.yellow}-k, --skip-installed{self.endc} Skip installed packages.\n'
|
||||
f' {self.yellow}-E, --full-reverse{self.endc} Full reverse dependency.\n'
|
||||
f' {self.yellow}-S, --search{self.endc} Search packages from the repository.\n'
|
||||
f' {self.yellow}-o, --no-silent{self.endc} Disable silent mode.\n'
|
||||
f' {self.yellow}-p, --pkg-version{self.endc} Print the repository package version.\n'
|
||||
f' {self.yellow}-e, --directory={self.endc}PATH Download files to a specific path.\n'
|
||||
f' {self.yellow}-F, --file-pattern={self.endc}PATTERN Include specific installed files.\n'
|
||||
f' {self.yellow}-o, --no-silent{self.endc} Disable silent mode.\n'
|
||||
f' {self.yellow}-p, --pkg-version{self.endc} Print the repository package version.\n'
|
||||
f' {self.yellow}-e, --directory={self.endc}PATH Download files to a specific path.\n'
|
||||
f' {self.yellow}-F, --file-pattern={self.endc}PATTERN Include specific installed files.\n'
|
||||
'\n -h, --help Show this message and exit.\n'
|
||||
' -v, --version Print version and exit.\n'
|
||||
'\nEdit the configuration file in the /etc/slpkg/slpkg.toml \n'
|
||||
|
|
|
@ -20,7 +20,7 @@ class ViewMessage(Configs):
|
|||
def __init__(self, flags: list):
|
||||
super(Configs, self).__init__()
|
||||
self.flags = flags
|
||||
self.flag_resolve_off = ['-L', '--resolve-off']
|
||||
self.flag_resolve_off = ['-l', '--resolve-off']
|
||||
self.flag_reinstall = ['-R', '--reinstall']
|
||||
self.flag_yes = ['-y', '--yes']
|
||||
self.file_pattern = f'*{self.sbo_repo_tag}'
|
||||
|
|
Loading…
Reference in a new issue