mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-29 20:34:22 +01:00
Updated for options
This commit is contained in:
parent
4001f82d47
commit
2b891a54c2
8 changed files with 35 additions and 28 deletions
|
@ -21,7 +21,7 @@ class Downloader(Configs, Utilities):
|
||||||
self.path = path
|
self.path = path
|
||||||
self.url = url
|
self.url = url
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
self.flag_no_silent = ['-ns', '--no-silent']
|
self.flag_no_silent = ['-o', '--no-silent']
|
||||||
self.filename = url.split('/')[-1]
|
self.filename = url.split('/')[-1]
|
||||||
self.color = self.colour()
|
self.color = self.colour()
|
||||||
self.bold = self.color['bold']
|
self.bold = self.color['bold']
|
||||||
|
|
|
@ -49,23 +49,23 @@ class Argparse(Configs):
|
||||||
self.flag_jobs = '--jobs'
|
self.flag_jobs = '--jobs'
|
||||||
self.flag_short_jobs = '-j'
|
self.flag_short_jobs = '-j'
|
||||||
self.flag_resolve_off = '--resolve-off'
|
self.flag_resolve_off = '--resolve-off'
|
||||||
self.flag_short_resolve_off = '-ro'
|
self.flag_short_resolve_off = '-L'
|
||||||
self.flag_reinstall = '--reinstall'
|
self.flag_reinstall = '--reinstall'
|
||||||
self.flag_short_reinstall = '-R'
|
self.flag_short_reinstall = '-R'
|
||||||
self.flag_skip_installed = '--skip-installed'
|
self.flag_skip_installed = '--skip-installed'
|
||||||
self.flag_short_skip_installed = '-si'
|
self.flag_short_skip_installed = '-k'
|
||||||
self.flag_full_reverse = '--full-reverse'
|
self.flag_full_reverse = '--full-reverse'
|
||||||
self.flag_short_full_reverse = '-fr'
|
self.flag_short_full_reverse = '-E'
|
||||||
self.flag_search = '--search'
|
self.flag_search = '--search'
|
||||||
self.flag_short_search = '-S'
|
self.flag_short_search = '-S'
|
||||||
self.flag_no_silent = '--no-silent'
|
self.flag_no_silent = '--no-silent'
|
||||||
self.flag_short_no_silent = '-ns'
|
self.flag_short_no_silent = '-o'
|
||||||
self.flag_directory = '--directory='
|
|
||||||
self.flag_short_directory = '-dir='
|
|
||||||
self.flag_pkg_version = '--pkg-version'
|
self.flag_pkg_version = '--pkg-version'
|
||||||
self.flag_short_pkg_version = '-pv'
|
self.flag_short_pkg_version = '-p'
|
||||||
|
self.flag_directory = '--directory='
|
||||||
|
self.flag_short_directory = '-e='
|
||||||
self.flag_file_pattern = '--file-pattern='
|
self.flag_file_pattern = '--file-pattern='
|
||||||
self.flag_short_file_pattern = '-fp='
|
self.flag_short_file_pattern = '-F='
|
||||||
|
|
||||||
self.flag_searches = [self.flag_short_search, self.flag_search]
|
self.flag_searches = [self.flag_short_search, self.flag_search]
|
||||||
|
|
||||||
|
@ -115,6 +115,13 @@ class Argparse(Configs):
|
||||||
self.file_pattern = arg.split('=')[1]
|
self.file_pattern = arg.split('=')[1]
|
||||||
self.args[self.args.index(arg)] = self.flag_file_pattern
|
self.args[self.args.index(arg)] = self.flag_file_pattern
|
||||||
|
|
||||||
|
# Fixed for merge options if used, like: -yjR
|
||||||
|
for args in self.args:
|
||||||
|
if args.startswith('-') and len(args) > 2:
|
||||||
|
self.args.remove(args)
|
||||||
|
for arg in args[1:]:
|
||||||
|
self.flags.append(f'-{arg}')
|
||||||
|
|
||||||
for opt in self.options:
|
for opt in self.options:
|
||||||
if opt in self.args:
|
if opt in self.args:
|
||||||
self.args.remove(opt)
|
self.args.remove(opt)
|
||||||
|
|
|
@ -32,8 +32,8 @@ class RemovePackages(Configs):
|
||||||
self.dependencies = []
|
self.dependencies = []
|
||||||
self.utils = Utilities()
|
self.utils = Utilities()
|
||||||
self.progress = ProgressBar()
|
self.progress = ProgressBar()
|
||||||
self.flag_resolve_off = ['-ro', '--resolve-off']
|
self.flag_resolve_off = ['-L', '--resolve-off']
|
||||||
self.flag_no_silent = ['-ns', '--no-silent']
|
self.flag_no_silent = ['-o', '--no-silent']
|
||||||
self.output = 0
|
self.output = 0
|
||||||
self.remove_pkg = None
|
self.remove_pkg = None
|
||||||
self.stderr = None
|
self.stderr = None
|
||||||
|
|
|
@ -52,10 +52,10 @@ class Slackbuilds(Configs):
|
||||||
self.byellow = f'{self.bold}{self.yellow}'
|
self.byellow = f'{self.bold}{self.yellow}'
|
||||||
self.bred = f'{self.bold}{self.red}'
|
self.bred = f'{self.bold}{self.red}'
|
||||||
self.flag_reinstall = ['-R', '--reinstall']
|
self.flag_reinstall = ['-R', '--reinstall']
|
||||||
self.flag_skip_installed = ['-si', '--skip-installed']
|
self.flag_skip_installed = ['-k', '--skip-installed']
|
||||||
self.flag_resolve_off = ['-ro', '--resolve-off']
|
self.flag_resolve_off = ['-L', '--resolve-off']
|
||||||
self.flag_jobs = ['-j', '--jobs']
|
self.flag_jobs = ['-j', '--jobs']
|
||||||
self.flag_no_silent = ['-ns', '--no-silent']
|
self.flag_no_silent = ['-o', '--no-silent']
|
||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
""" Starting build or install the slackbuilds. """
|
""" Starting build or install the slackbuilds. """
|
||||||
|
|
|
@ -15,7 +15,7 @@ class Tracking(Configs, Utilities):
|
||||||
super(Configs, self).__init__()
|
super(Configs, self).__init__()
|
||||||
super(Utilities, self).__init__()
|
super(Utilities, self).__init__()
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
self.flag_pkg_version = ['-pv', '--pkg-version']
|
self.flag_pkg_version = ['-p', '--pkg-version']
|
||||||
self.ascii = Ascii()
|
self.ascii = Ascii()
|
||||||
self.llc = self.ascii.lower_left_corner
|
self.llc = self.ascii.lower_left_corner
|
||||||
self.hl = self.ascii.horizontal_line
|
self.hl = self.ascii.horizontal_line
|
||||||
|
|
|
@ -25,10 +25,10 @@ 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}] [-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}] [-f, find, -w, view, -s, search] <packages>\n'
|
||||||
f' slpkg [{self.cyan}COMMAND{self.endc}] [-e, dependees, -t, tracking] <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, -ro, --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}] [-si, --skip-installed, -fr, --full-reverse, -S, --search]\n'
|
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-k, --skip-installed, -E, --full-reverse, -S, --search]\n'
|
||||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-ns, --no-silent, -dir=, --directory=PATH]\n'
|
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-o, --no-silent, -p, --pkg-version]\n'
|
||||||
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-pv, --pkg-version, -fp=, --file-pattern=PATTERN]\n'
|
f' slpkg [{self.yellow}OPTIONS{self.endc}] [-e, --directory=PATH, -F, --file-pattern=PATTERN]\n'
|
||||||
" \nIf you need more information please try 'slpkg --help'.")
|
" \nIf you need more information please try 'slpkg --help'.")
|
||||||
|
|
||||||
print(args)
|
print(args)
|
||||||
|
@ -59,15 +59,15 @@ class Usage(Configs):
|
||||||
f'\n{self.bold}OPTIONS:{self.endc}\n'
|
f'\n{self.bold}OPTIONS:{self.endc}\n'
|
||||||
f' {self.yellow}-y, --yes{self.endc} Answer Yes to all questions.\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}-j, --jobs{self.endc} Set it for multicore systems.\n'
|
||||||
f' {self.yellow}-ro, --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}-R, --reinstall{self.endc} Upgrade packages of the same version.\n'
|
||||||
f' {self.yellow}-si, --skip-installed{self.endc} Skip installed packages.\n'
|
f' {self.yellow}-k, --skip-installed{self.endc} Skip installed packages.\n'
|
||||||
f' {self.yellow}-fr, --full-reverse{self.endc} Full reverse dependency.\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}-S, --search{self.endc} Search packages from the repository.\n'
|
||||||
f' {self.yellow}-ns, --no-silent{self.endc} Disable silent mode.\n'
|
f' {self.yellow}-o, --no-silent{self.endc} Disable silent mode.\n'
|
||||||
f' {self.yellow}-dir=, --directory={self.endc}PATH Download files to a specific path.\n'
|
f' {self.yellow}-p, --pkg-version{self.endc} Print the repository package version.\n'
|
||||||
f' {self.yellow}-pv, --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}-fp=, --file-pattern={self.endc}PATTERN Include specific installed files.\n'
|
f' {self.yellow}-F, --file-pattern={self.endc}PATTERN Include specific installed files.\n'
|
||||||
'\n -h, --help Show this message and exit.\n'
|
'\n -h, --help Show this message and exit.\n'
|
||||||
' -v, --version Print version and exit.\n'
|
' -v, --version Print version and exit.\n'
|
||||||
'\nEdit the configuration file in the /etc/slpkg/slpkg.toml \n'
|
'\nEdit the configuration file in the /etc/slpkg/slpkg.toml \n'
|
||||||
|
|
|
@ -17,7 +17,7 @@ class ViewPackage(Configs, Utilities):
|
||||||
super(Configs, self).__init__()
|
super(Configs, self).__init__()
|
||||||
super(Utilities, self).__init__()
|
super(Utilities, self).__init__()
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
self.flag_pkg_version = ['-pv', '--pkg-version']
|
self.flag_pkg_version = ['-p', '--pkg-version']
|
||||||
self.session = Session
|
self.session = Session
|
||||||
|
|
||||||
def package(self, packages: list):
|
def package(self, packages: list):
|
||||||
|
|
|
@ -20,7 +20,7 @@ class ViewMessage(Configs):
|
||||||
def __init__(self, flags: list):
|
def __init__(self, flags: list):
|
||||||
super(Configs, self).__init__()
|
super(Configs, self).__init__()
|
||||||
self.flags = flags
|
self.flags = flags
|
||||||
self.flag_resolve_off = ['-ro', '--resolve-off']
|
self.flag_resolve_off = ['-L', '--resolve-off']
|
||||||
self.flag_reinstall = ['-R', '--reinstall']
|
self.flag_reinstall = ['-R', '--reinstall']
|
||||||
self.flag_yes = ['-y', '--yes']
|
self.flag_yes = ['-y', '--yes']
|
||||||
self.file_pattern = f'*{self.sbo_repo_tag}'
|
self.file_pattern = f'*{self.sbo_repo_tag}'
|
||||||
|
|
Loading…
Add table
Reference in a new issue